Max
Max

Reputation: 13338

Filtering strings

I'am trying to filter a string with Regex.Replace, but I'am stuck on Replacing text like this: [02] or [06].

The code I'am using now is:

string cleanData = Regex.Replace(stringtext, "[..]", "");

Does anybody have any ideas?

Upvotes: 1

Views: 82

Answers (1)

Michel Keijzers
Michel Keijzers

Reputation: 15357

Use

string cleanData = Regex.Replace(stringtext, @"\[..\]", "");

(cannot test it).

Upvotes: 1

Related Questions