Skip to content Skip to sidebar Skip to footer

Regex Match Whole Word Including Whitespace And Fullstop

I am trying to build a regex that matches a word within

and

tags and replace the word with some other text. This word could be at the start of a tag or betwee

Solution 1:

\b(Cat|Dog|Fish)\b

Use \b or word boundary.

\b assert position at a word boundary (^\w|\w$|\W\w|\w\W)


Post a Comment for "Regex Match Whole Word Including Whitespace And Fullstop"