hi i need to match the following string in c#
for example
-34
-67
-23
-46
-00
i would loop over开发者_如何学Go the string and check each char but thats messy and i have no idea about regex so was hoping for some help.
thanks
The following regex should work
@"-\d\d"
-(\d\d)
is the pattern
Regex rx = new Regex(@"-(\d\d)");
var matches = rx.Matches(str);
foreach (var match in matches)
Console.WriteLine(match.Groups[1].Value);
I think -\d\d should be able to do it
精彩评论