nlp.js icon indicating copy to clipboard operation
nlp.js copied to clipboard

Using lookbehind regexs will break in some browers

Open vanbasten17 opened this issue 4 years ago • 4 comments

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

vanbasten17 avatar Nov 30 '20 12:11 vanbasten17

any update on this @jesus-seijas-sp ?

vanbasten17 avatar Jan 29 '21 08:01 vanbasten17

Hello,

Well, I'm very lost with this one, to be honest. Any help is welcome.

jesus-seijas-sp avatar Jan 29 '21 08:01 jesus-seijas-sp

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?

vanbasten17 avatar Jan 29 '21 09:01 vanbasten17

@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 👍

vanbasten17 avatar Feb 01 '21 16:02 vanbasten17

Closing due to inactivity. Please, re-open if you think the topic is still alive.

aigloss avatar Nov 24 '22 12:11 aigloss