How to match exact string that contains a lot of special characters in PCRE

Viewed 10

I Need to PCRE to match this string exactly

Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)

I tried

^Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)$

which does not work because there are a lot of / and .

I was able to match with this

^Mozilla\/5\.0 \(compatible; bingbot\/2\.0; \+http:\/\/www\.bing\.com\/bingbot\.htm\)$

but as you can see thats alot of escaping.

I am trying to PCRE match all the browser user-agents.

Is there a better way to do this?

0 Answers
Related