c#Regex捕获所有匹配项

时间:2011-09-17 13:18:46

标签: c# regex match

我的输入字符串是:

(article.dos = $_article.dos_2_998_$ or article.des like $_article.des_3_%toto tata_$)

我目前的正则表达式是:(.*)(?<t>\$_(.+)_\$)(.*)

所以我想要提取所有$ _ ... _ $,但regex.Matches只给出最后一个匹配:$ _article.des_3_%toto tata _ $

有什么想法吗?

感谢。

编辑:输入字符串也可以包含$ character。

1 个答案:

答案 0 :(得分:3)

将正则表达式更改为:

(?<t>\$_([^$]+)_\$)
相关问题