Xavinou
Xavinou

Reputation: 802

c# Regex capture all matches

My input string is :

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

My current regex is : (.*)(?<t>\$_(.+)_\$)(.*)

So I want extract all $_ ... _$, but regex.Matches gives only the last match : $_article.des_3_%toto tata_$

Any ideas ?

Thanks.

edit : The input string can also contains $ character.

Upvotes: 0

Views: 298

Answers (1)

TheCodeKing
TheCodeKing

Reputation: 19220

Change your regex to:

(?<t>\$_([^$]+)_\$)

Upvotes: 3

Related Questions