I'm currently trying to learn regular expressions with some simple "real world" examples.
Take in consideration the following string:
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.2a1pre) Gecko
I want to find the RV value (1.9.2a1pre). I need to apply the following rules:
- RV: can be in any case (RV, rv, rV, Rv...).
- RV: can be anywhere in the string.
- The RV: value ends with either a closing parenthesis, any whitespace (including linebreak), a semicolon or the end of string.
So far I did:
/rv:[.][\)]?/i
but it's not working (I must be far from the "true" solution)...
The expression must work with PHP preg_match.