nlp.js
nlp.js copied to clipboard
Using lookbehind regexs will break in some browers
Describe the bug Lookbehind regexs won't work in some browsers.
To Reproduce Steps to reproduce the behavior: We just tried to load UkStemmer into Safari and downloaded JS will break.
Expected behavior It should work as expected.
Screenshots https://stackoverflow.com/questions/51568821/works-in-chrome-but-breaks-in-safari-invalid-regular-expression-invalid-group In lines like:
/(?:[иы]в(?:ши(?:сь)?)?|(?<=[ая])(?:в(?:ши(?:сь)?)?))$/
Desktop (please complete the following information):
- Browser: Safari
Additional context
any update on this @jesus-seijas-sp ?
Hello,
Well, I'm very lost with this one, to be honest. Any help is welcome.
IMHO, I think that the only way to solve this is to finde an alternative regex that do the same job and that is supported in all browsers. Here a list of supported ones: https://caniuse.com/?search=lookbehind%20assertions, do you know how this can be replaced?
@jesus-seijas-sp , we have reimplemented the UK Stemmer in the linked commit that @elozano98 has posted. Let us know if you need help with anything 👍
Closing due to inactivity. Please, re-open if you think the topic is still alive.