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

quoted search is still being treated as regex #57

Closed ericpyle closed 6 years ago

ericpyle commented 6 years ago

when I search for "Download (" I get the following error stack.

index.js:180 Uncaught SyntaxError: Invalid regular expression: /(/: Unterminated group
    at RegExp (<anonymous>)
    at http://localhost:1212/dist/renderer.dev.js:16512:18
    at Stack.reduce (native)
    at defaultFindChunks (http://localhost:1212/dist/renderer.dev.js:16505:5)
    at Object.values.reduce (http://localhost:1212/dist/renderer.dev.js:1475:64)
    at Array.reduce (native)
    at getBundleSearchResults (http://localhost:1212/dist/renderer.dev.js:1472:73)
    at Object.values.reduce (http://localhost:1212/dist/renderer.dev.js:1413:35)
    at Array.reduce (native)
    at getAllSearchResults (http://localhost:1212/dist/renderer.dev.js:1409:60)

Do I need to turn off regex entirely if user types in a quoted string?

ericpyle commented 6 years ago

sorry I forgot I was using the split-string library for handling quoted strings