我想它来搜索字符串像在C#中使用正则表达式"$12,56,450"
,但它并没有字符串
符合以下是我的代码:
string input="Total earn for the year $12,56,450";
string pattern = @"\b(?mi)($12,56,450)\b";
Regex regex = new Regex(pattern);
if (regex.Match(input).Success)
{
return true;
}
你应该逃避'$'符号,首先一个数字;在它前面使用'\ b'可能没有意义,其次(因为'$'是非单词字符)。最后,这里有'mi'修饰符的含义是什么? – raina77ow
'我希望它搜索字符串像“$ 12,56450”'你的意思是确切的字符串或什么..? –
我想搜索整个词这就是为什么我使用“英里”,但我不知道哪个是工作或不 – user2463266