Reputation: 3355
I'm doing a find and replace in VSCode for some CSS classes and I'm running into the following issue when matching for the word row
. It finds row
successfully, but I'm trying to avoid it from also matching things like row-label
. Is there a way to match strings that only includes things such as row
and .row
?
Upvotes: 6
Views: 2410
Reputation: 180765
Try (?<![\w-])(row)[^-\w]
Negative lookbehind to eliminate \w
or -
from immediately preceding row
.
And following character cannot be \w
or -
.
If necessary to avoid row
followed by characters such as !
or $
etc. you could use
(?<![\w-])(row)[^-\w!@$%^&*)_+\-=\[\]{};':"\\|,.\/?]
https://regex101.com/r/tUMNOu/10
Upvotes: 3