Alter Regular Expression to Return 2 Values Instead of 3 from userAgent String
- by Jay
I've taken a regular expression from jQuery to detect if a browser's engine is WebKit and gets it's version number, it returns 3 values extracted from the userAgent string: webkit/….…, webkit and ….… [“….…” being the version number].
I would like the regular expression to return just 2 values: webkit and ….….
I'm rubbish at regular expressions, so please can you give an explanation of the expression with your answer.
The regular expression I'm currently working with and wish to improve is: /(webkit)[\/]([\w.]+)/.
I appreciate all your help, thanks in advance!