browserslist/browserslist-useragent-regexp

Ipad OS 16.5 in Safari do not match RegExp by getUserAgentRegex, with no version

ChenShuy1 opened this issue · 2 comments

Describe your question

Current and expected behavior
I have a user accessing my site from Chrome on an iPad Pro with iOS 16. At the "mobile view", it uses the following user-agent:

Mozilla/5.0 (iPad; CPU OS16 5 like Mac OS X)AppleWebKit/605.1.15(KHTML, like Gecko) Crios/112.0.5615.70 Mobile15E148 Safari/604.1

get the regexp by getUserAgentRegex like:

getUserAgentRegex({
   ...defaultOptions,
   allowHigherVersions: true,
   ignorePatch: true,
   allowZeroSubversions: true,
   browsers: ['chrome > 1', 'safari > 1', 'edge > 1'],
});

and it's return:

/Edge?\/(1[2-9]|[2-9]\d|\d{3,})(\.\d+|)(\.\d+|)|Chrom(ium|e)\/([4-9]|\d{2,})\.\d+(\.\d+|)([\d.]+$|.*Safari\/(?![\d.]+ Edge\/[\d.]+$))|Maci.+ Version\/(3\.([1-9]|\d{2,})|([4-9]|\d{2,})\.\d+)([,.]\d+|)( Mobile\/\w+|) Safari\//

This does not match the my browser configuration in browserslist-useragent-regex with the latest version.

It's seems like the reg check the platform(etc. IPad or Macintosh), how could I avoid the platform check but the browser type and version.

browserslist-useragent-regexp version
4.0.0

@chenshy39 Hi.

"mobile view"
...
Mozilla/5.0 (iPad; CPU OS16 5 like Mac OS X)AppleWebKit/605.1.15(KHTML, like Gecko) Crios/112.0.5615.70 Mobile15E148 Safari/604.1
...
browsers: ['chrome > 1', 'safari > 1', 'edge > 1'],

#1478 (comment)

to match this user-agent you should use "iOS" query.

thanks a lot! It's works.😆