4 ms·
Literally an hour ago, I ran into an issue where Safari does not support lookbehind in regular expressions. https://caniuse.com/js-regexp-lookbehind https://can
by SCLeo 4y ago
Literally an hour ago, I ran into an issue where Safari does not support lookbehind in regular expressions. https://caniuse.com/js-regexp-lookbehind https://caniuse.com/js-regexp-lookbehind
Say what you want but it is so frustrating when you run into problems like this. It does remind me of old IE days where we had to produce one gazillion hacks for IE.
- honkdaddy 4y agoIn this situation, grabbing a 3rd party JS regex library for a handful of kilobytes probably solves your problem, but I’m sure that crossed your mind. Is it really as bad as the IE days though? I didn’t work on web back then, but these days if I run into a safari comparability issue, the workaround is usually pretty painless.
- SCLeo 4y agoI do not believe there is a 3rd party polyfill for lookbehind as it is quite tricky to implement regular expressions. If you found one, please let me know. Thanks in advance.
- ntoskrnl 4y agoThere's always this: https://xregexp.com/ https://xregexp.com/ But it's not really a polyfill, just a library.
- eyelidlessness 4y agoOn mobile and can’t tell whether xregexp still doesn’t have lookbehind, but in case it doesn’t I found this: https://github.com/beaugunderson/xregexp-lookbehind https://github.com/beaugunderson/xregexp-lookbehind
- tomgp 4y agoI did work on the web back in those days. The situation now is nothing like it was during IE's dominance in the early 2000s, to claim it is is hyperbole at best.
- RobertRoberts 4y agoYou are right, it's worse because the problem is more hidden and therefore a lot harder to solve. At least in the IE days everyone _knew_ IE was a problem, so we were looking for a solution as a community. Now? We comments that are dismissive of crap instead of inspiring towards quality.
- lern_too_spel 4y agoIn the IE days, you could tell the visitor to use Firefox. iOS does not allow such an easy fix.
- ntoskrnl 4y agoI second this. I hit a goofy issue recently too: Safari can't select text in text boxes... but only sometimes. What causes it is unclear. Out of this mountain of workarounds, I had to use setTimeout: https://stackoverflow.com/questions/3272089/programmatically-selecting-text-in-an-input-field-on-ios-devices-mobile-safari https://stackoverflow.com/questions/3272089/programmatically... And in Safari there's zero visibility into why things break, they just silently don't work. At least Chrome is pretty good (in my experience) about throwing an exception or at least logging warnings to the console
- mythz 4y agoI had the same issue & had to rewrite not to use RegEx [1], but if that's the main issue people are running into, it's a non-issue that can easily be worked around. Personally I find Safari a great browser on iOS and prefer not to add to the test matrix burden with different browser engines on iOS. Also this restriction is the only thing keeping Chrome from dominating the future of Web, who can't be trusted to not use it as an anti competitive weapon as we've seen with AMP. [1] https://stackoverflow.com/a/71168150/85785 https://stackoverflow.com/a/71168150/85785
- nsonha 4y agoDoesn't Safari have superior baterry life? People have different priority, most end user gives no fuck about the pile of garbage APIs that just keeps growing in modern browsers, they just wanna read some stuff. When developers cry about their "api", some kid in africa isn't able to access knowledge on ther internet because sites have to use look behind or whatever.