简体   繁体   中英

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?

Use

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

(cannot test it).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM