Find substring ignoring specified characters

Posted by Fredy Treboux on Stack Overflow See other posts from Stack Overflow or by Fredy Treboux
Published on 2010-04-07T13:05:08Z Indexed on 2010/04/07 13:13 UTC
Read the original article Hit count: 244

Filed under:
|
|
|

Hello, please, does any of you knows and can share an easy/clean way to find a substring within a string, but ignoring some specified characters to find it. I think an example would explain things better:

  • string: "Hello, -this- is a string"
  • substring to find: "Hello this"
  • chars to ignore: "," and "-"
  • found the substring, result: "Hello, -this"

Using Regex it's not a requirement for me, just added the tag because it feels related.

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET