Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lookbehind is not supported in all browsers (Safari) #20

Open
bartversluijs opened this issue Feb 2, 2021 · 3 comments
Open

Lookbehind is not supported in all browsers (Safari) #20

bartversluijs opened this issue Feb 2, 2021 · 3 comments

Comments

@bartversluijs
Copy link

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!

@fregante
Copy link

Bad news, Safari 15 doesn’t support it either https://caniuse.com/?search=regexp%20lookbehind

@dzikoysk
Copy link

dzikoysk commented Feb 26, 2022

Same for us:

obraz

Page stays blank then, so it's pretty much unusable in any app that has to support all browsers.

@antongolub
Copy link
Contributor

antongolub commented May 25, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@fregante @dzikoysk @antongolub @bartversluijs and others