C# - How do find a string within a string even if it spans across whitespace?

Posted by James Heaney on Stack Overflow See other posts from Stack Overflow or by James Heaney
Published on 2010-03-30T09:25:27Z Indexed on 2010/03/30 9:33 UTC
Read the original article Hit count: 374

Filed under:
|
|
|
|

I want to be able to find and highlight a string within a string BUT I no not want to remove the space.

So if my original string is :

There are 12 monkeys

I want to find '12 mon' and highlight those characters ending up with :

There are < font color='red' >12 mon< /font >keys

BUT I also want the same result if I search for '12mon' (no space this time)

This has really bent my mind! I'm sure it can be done with Regex.

© Stack Overflow or respective owner

Related posts about c#

Related posts about regex