I have some task: exist default keywords collection, and when user input new keyword, it must be filtering by exist keyword collection and inform user about duplicate.
The duplicate of the keyword is considered to be at the beginning of the line or separated by commas iside line, i.e
//start line keyword1,
//start line keyword2,
// inside line some text, keyword1, some text, keyword2,
Not duplicate: text keyword1, keyword2 text, text keyword1 text, keyword1 keyword2, keyword1x, xkeyword1.
This regular expression
/(?<!\w|\w\s)(keyword1|keyword2)(?!\w|\s\w)/gmi
works fine in chrome, but does not work in safari or firefox, because "lookbehind"
(? <! ...)
,is not yet supported in these browsers.
How can i handle lookbehind another reg expression?
Sorry, for my English.