For example:
- Oldcoin23
- coin
In this above two words i only need to get the second word ‘coin’
I searched the word ‘coin’ in Vs Code by pressing Ctrl + Shift + F. But I am getting both word as a result. I.e., ‘coin’ and ‘Oldcoin23’.
How can I get only the word of ‘coin’ and not any other word that contain the word ‘coin’ inside.
2
Answers
Use this regex search pattern:
(?<!w)coin(?!w)
. To use this, you need to check the regex box in the find menu.The way the regex works is that it uses a negative lookbehind
(?<!w)
to discard any results that have a word character before them, and a negative lookahead to discard any results that have a word character in front of them,(?!w)
, and searches for the wordcoin
.Enable regex mode for the find widget (use the / button or alt+r), and then put
bcoinb
in the search input. In Regex,b
means to match word boundaries. Quoting regex101.com: