bvaughn / react-highlight-words

React component to highlight words within a larger body of text
https://bvaughn.github.io/react-highlight-words/
MIT License
2.16k stars 170 forks source link

Bracket error regexp #51

Closed Lemaro86 closed 6 years ago

Lemaro86 commented 6 years ago

If textToHighlight have bracket, for example: textToHighlight='Hi (friend)'

I have got error if i remove this bracket: textToHighlight='Hi (friend'

main.js:375 Uncaught SyntaxError: Invalid regular expression: /БАНК "ТАВРИЧЕСКИЙ" (ОАО/: Unterminated group

I think trouble in 'highlight-words-core' in function escapeRegExpFn

Lemaro86 commented 6 years ago

autoEscape= true resolve it. forgive me for dullness

bvaughn commented 6 years ago

No worries. Glad you figured it out..