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.18k stars 171 forks source link

Can I only match one time ? #84

Closed BertieGo closed 5 years ago

BertieGo commented 5 years ago

Hi, example, I got string like : hello world. and I input "l" then all "l" will be matched, but I just wanna match first one "l", what option can do that ? thx :)

bvaughn commented 5 years ago

You could use the activeIndex prop and change the style/CSS with either activeClassName or activeStyle then just make the other matches look unhighlighted with the normal clasaName/style.

On Wed, Jun 5, 2019, 6:42 PM BertieHuang notifications@github.com wrote:

Hi, example, I got string like : hello world.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bvaughn/react-highlight-words/issues/84?email_source=notifications&email_token=AAAHHHPRB6JTHQ3EOM322Y3PZBTPFA5CNFSM4HUTKME2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GX5BQGQ, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAHHHOBGVFCLGJFL5I5ZJDPZBTPFANCNFSM4HUTKMEQ .