Closed dkocich closed 6 years ago
I'm not familiar with markjs.
react-highlight-words supports regular expression syntax by default, so you can turn on "exact" matching mode using the word boundary character \b
. For example, searching "\bthe\b" will find exact matches for the word "the" while ignoring words like "other". 😄
I have no plans at this time to change the API.
Good, thanks - that is useful to know however I am not sure if it really works how it should with different RegExp
's. I do not see any tests for this case (using of boundary character - "\b") in https://github.com/bvaughn/react-highlight-words/blob/master/src/Highlighter.test.js . I managed to get this kind of search work with a double slash (\\bthe\\b
) and autoEscape
set to false.
I don't see great value in writing tests to verify regular expression behavior. My tests verify that the component accepts a regex. Beyond that I trust the browser to work.
Hello, thanks for the library. In https://markjs.io/#mark there are few options how highlight should mark words -
react-highlight-words
works now inaccuracy: "partially"
mode only. Are there any plans to extend the settings in the near future? I am currently looking for the solution how to mark only exact match of words.