I'm trying to detect version using regex of following browsers : Firefox, IE, Opera, Chrome and Safari.
Testing following userAgent information. If push |Chrome in regex than the result I am getting is 31.0.1650.63 instead of 18.0.1284.68
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36 OPR/18.0.1284.68 (Opera Browser)
Here is regex :
/(?:Firefox|MSIE|Version|OPR).?([0-9.]+)/i
This regex working just fine with all browsers which is included , but if I push |Chrome in marked expression then chrome and opera versions become complicated . Any advice how I can solve this problem with one regex statement , thanks ...
NOTE : Without any library . Question isn't repeated , existence examples uses libraries or kind of different situations