Lookbehind is not supported in all browsers (Safari)
Opened this issue · 3 comments
Hi all,
First of all, thanks for this package!
I'm using it to check the version input in a Vue.js frontend. However, when opening a page in Safari (the new Internet Explorer), a lookbehind in regex is not supported.
I'll try and change the Regex so it'll work in Safari. However, like most developers, regex is a "hocus-pocus language", especially when they're long like this one.
Any suggestions are welcome!
Bad news, Safari 15 doesn’t support it either https://caniuse.com/?search=regexp%20lookbehind
Just a suggestion: you can check the input size first and then apply semver "official" regex. There're no lookbehinds so it may be more suitable.
The key profit of lookbehind here is the redos-safe assertion that .a.b.c
meta follows after -foo.bar.etc
. Old good -(...*(\. ...* (+ ...*)?)?)?
-based approach might significantly affect performance.