highlight-within-textarea
highlight-within-textarea copied to clipboard
How to set word boundary using regex?
Please help.
In
highlight: 'title',
className: 'red'
I tried adding a /\btitle\b/g but it's not working and I'm not sure how to customize the library.
How can I add a word boundary for title so that it won't highlight "subtitle" or any other word with "title" in it?
You could just put a \s around the word title
Please tell me how? I tried \stitle\s but it's not working?
nvm that was wrong
You could use lookaround: (?<=\b)title(?=\b)
Sorry this is still not working for me. Is this applicable to what I'm using which is inside quotation marks?
highlight: '(?<=\b)title(?=\b)',
className: 'red'
So something like that?
But thank you for trying to help me, really appreciate it!