browserslist/browserslist-useragent-regexp

[Bug]: Safari 16.5.2 (a) is not matched

Patriksafar opened this issue · 2 comments

Would you like to work on a fix?

  • Check this if you would like to implement a PR, we are more than happy to help you go through the process.

Current and expected behavior

Current:

There is a new version of Safari with (a) in the version name. Full user agent:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.5.2 (a) Safari/605.1.15

Current version of browserslist-useragent-regexp does not handle that and does not match the users user agent.

If I remove the (a) manually it correctly matche the regex.

My browserlist is not really strict:

last 2 years
not dead

The example of our Regexp:

/Edge?\/(9[2-9]|\d{3,})(\.\d+|)(\.\d+|)|Firefox\/(9[1-9]|\d{3,})\.\d+(\.\d+|)|Chrom(ium|e)\/(9[2-9]|\d{3,})\.\d+(\.\d+|)|Maci.* Version\/(1[5-9]|[2-9]\d|\d{3,})\.\d+([,.]\d+|)( Mobile\/\w+|) Safari\/|Chrome.+OPR\/(7[89]|[89]\d|\d{3,})\.\d+\.\d+|(CPU[ +]OS|iPhone[ +]OS|CPU[ +]iPhone|CPU IPhone OS|CPU iPad OS)[ +]+(1[5-9]|[2-9]\d|\d{3,})[._]\d+([._]\d+|)|Android:?[ /\-](1{2}[4-9]|1[2-9]\d|[2-9]\d{2}|\d{4,})(\.\d+|)(\.\d+|)|Mobile Safari.+OPR\/(7[3-9]|[89]\d|\d{3,})\.\d+\.\d+|Android.+Firefox\/(1{2}[5-9]|1[2-9]\d|[2-9]\d{2}|\d{4,})\.\d+(\.\d+|)|Android.+Chrom(ium|e)\/(1{2}[4-9]|1[2-9]\d|[2-9]\d{2}|\d{4,})\.\d+(\.\d+|)|Android.+(UC? ?Browser|UCWEB|U3)[ /]?(1[5-9]|[2-9]\d|\d{3,})\.\d+\.\d+|SamsungBrowser\/(1[5-9]|[2-9]\d|\d{3,})\.\d+|Android.+MQ{2}Browser\/(1[3-9]|[2-9]\d|\d{3,})(\.\d+|)(\.\d+|)|K[Aa][Ii]OS\/([3-9]|\d{2,})\.\d+(\.\d+|)/;

Expected behaviour

It would be great if RegExp would support also Safari with (a) in user agent string.

Reproduction

Use the regexp above and make simple test

browserslist-useragent-regexp version

v4.0.0

Possible solution

No response

@Patriksafar fixed in ua-regexes-lite@1.1.5. Reinstall browserslist-useragent-regexp to trigger ua-regexes-lite update, or just install it as dev dependency.

Awesome thank you! Seems to work!