Reputation: 11734
I have the following text:
I like a bit of rum with my crumble pie.
I want to build a regex search expression to return just the word 'rum' not 'crumble' as well. Also I need it to be case insensitive.
Upvotes: 33
Views: 94619
Reputation: 174696
Use word boundary \b
in your regex,
(?i)\brum\b
OR
Use lookahead and lookbehind,
(?i)(?<= |^)rum(?= |$)
Upvotes: 63