regex for matching browser against browscap-db?

267 views
Skip to first unread message

Michael Klink

unread,
Dec 29, 2014, 6:42:28 AM12/29/14
to brow...@googlegroups.com
hi there,

i've uploaded the browscap.csv into mysql, but how can i now match a user agent against the browser pattern stored in the db?

i need a regex to match $_SERVER['HTTP_USER_AGENT'] against the pattern for a select like this:

select * from browscap where pattern = $_SERVER['HTTP_USER_AGENT']

James Titcumb

unread,
Dec 29, 2014, 9:12:19 AM12/29/14
to browscap on behalf of Michael Klink
Hi Michael,

The match strings offered by browscap are not regular expressions, although it is not difficult to turn them into such.

As it looks like you're using PHP, I recommend using our supported client, which can be found at https://github.com/browscap/browscap-php - perhaps if you are daring enough, you could try out the 3.x branch and give us some feedback :)

Thanks
James


--
You received this message because you are subscribed to the Google Groups "browscap" group.
To unsubscribe from this group and stop receiving emails from it, send an email to browscap+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages