将PHP preg_match模式转换为C#模式

时间:2014-03-13 09:39:10

标签: c# php regex

我有一个PHP preg_match模式来过滤名称中的使命召唤(Quake Engine)颜色,

这是PHP中的模式

 preg_replace('~(\^[0-9])~', '', $CleanNames);

我需要将其转换为C#。像Something.Replace(~(\^[0-9])~, string) pattern

这样的东西

因为模式/正则表达式真的令人困惑,对我来说没什么意义。 请有人帮忙吗。或者有一个我可以转换它的地方吗?

任何帮助将不胜感激!!!

1 个答案:

答案 0 :(得分:0)

~正在改变PHP中的正则表达式。因此,请从c#

中删除那些内容
using System.Text.RegularExpressions;
string input = Regex.Replace(input, @"(\^[0-9])", "");

你会发现很多sites like this来解释你的正则表达式。