Regex browser version match

Posted by Matic on Stack Overflow See other posts from Stack Overflow or by Matic
Published on 2009-08-10T06:30:58Z Indexed on 2011/01/08 10:53 UTC
Read the original article Hit count: 299

Filed under:
|
|

I have a string:

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729)

I want to know what version of Firefox is in the string (3.5.2).

My current regex is:

Firefox\/[0-9]\.[0-9]\.[0-9]

and it returns Firefox/3.5.2

I only want it to return 3.5.2 from the Firefox version, not the other versions in the string. I already know the browser is Firefox.

© Stack Overflow or respective owner

Related posts about regex

Related posts about browser