I would like to find string matches within another string the following way:
Have a fix string like: "BRB"
Have different – test – sentences like:
- "What be right b means?" does not match
- "What b r b means?" match
- "What BR b means?" match
- "What BR-b means?" match
- "what brb means?" match
etc.
So I try to match the fix string within another string where possible whitespace characters (i.e. spaces) occures in between the characters.
How would it be possible to compose the regexp?
I am a newbie regex user so could not figure out how to do.
2
Answers
You could use the following regex pattern, in case insensitive mode:
Demo
This pattern says to match:
b
a word boundary(?i)
in case insensitive modeb
the first letterb
[ -]
optional space or hyphen separatorr
the second letterr
[ -]
optionap space or hyphen separatorb
third letterb
b
word boundaryFor c# you can use this
Regex101