I have the following regexp
var value = "hello";
"(?<start>.*?\W*?)(?<term>" + Regex.Escape(value) + @")(?<end>\W.*?)"
I’m trying to figure out the meaning, because it doesnt work against the single word.
for example, it matches “they said hello us”, but fails for just “hello”
can you please help me to decode what does this regexp string mean?!
PS: it’s .NET regexp
Its because of
\Win last part.\Wis nonA-Z0-9_char.In “they said hello us”, there is space after hello, but “hello” there is nothing there, thats why.
If you change it to
(?<end>\W*.*?)it may work.Actually, the regex itself does not make sense for me, it should rather like
\bis word boundary