browserslist/browserslist-useragent-regexp

[Bug]: Combinatorial inclusions don't render the correct regexp

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

We want to support Chrome 41 (the last 32-bit release) and Chrome versions 109+. I've tried writing this as a browserslist rule a few ways:

Browserslist Rule Produced Regexp
Chrome 41 or Chrome >= 109 and not Chrome 42-108 /Chrom(ium|e)\/(4[1-9]|[5-9]\d|\d{3,})\.\d+(\.\d+|)([\d.]+$|.*Safari\/(?![\d.]+ Edge\/[\d.]+$))/
Chrome 41 or Chrome >= 109 /Chrom(ium|e)\/(4[1-9]|[5-9]\d|\d{3,})\.\d+(\.\d+|)([\d.]+$|.*Safari\/(?![\d.]+ Edge\/[\d.]+$))/
Chrome >= 109 or Chrome 41 /Chrom(ium|e)\/(4[1-9]|[5-9]\d|\d{3,})\.\d+(\.\d+|)([\d.]+$|.*Safari\/(?![\d.]+ Edge\/[\d.]+$))/

And none of these regexps work against test UserAgent strings, as I would expect. I don't think my syntax is off. Is this a bug? If so, I'm happy to help resolve it.

Reproduction

Try generating regexps from combinatory browser versions.

browserslist-useragent-regexp version

v4.1.1

Possible solution

No response

@broguinn Hi.

  1. You can try to not use --allowHigherVersions, but then you should keep regex up to date with newer browsers
  2. You can help to implement --allowVersionsGap option, to apply "allowHigherVersions" only to last version, and strict match lower versions (#1498)

@broguinn Also you can fund me to help me spend more time on this project. It will help me to implement this feature early as possible.