Reputation: 3275
How can i do something like this.
new Regex("([^\d+]|[^one]|[^nine]|[^,])").Replace("Fi10An,fONEy,Onineo", "");
I would get this:
10,one,nine
But i would get a empty string with my wrong regex above.
Thank you in Advance!
Upvotes: 0
Views: 224
Reputation: 683
Try doing the opposite: match what you need and then take it from the string. For example:
Regex.Matches("Fi10An,fONEy,Onineo", @"(\d+|one|nine|,)", RegexOptions.IgnoreCase)
And then combine the matches into one string. This would be the easiest and the clearest solution.
Upvotes: 2