Reputation: 866
I need a regex expression that only searches for the word size
- non-case-sensitive, but excludes Drawing.size
and FontSize
So it could find the words:
size
Size
BSize
SizeA
but it would exclude the words like:
Drawing.size
FontSize
Upvotes: 1
Views: 473
Reputation: 107287
You can use a negative look ahead to exclude the prefix words:
/^(?:(?!(?:Drawing\.|Font)).)*size.*$/im
See demo https://regex101.com/r/kV2nR2/1
Note that the flag i
makes your regex case insensitive and m
is multiline flag and makes the anchors ^
and $
match the start and end of the regex for each line.
Upvotes: 1