I’m trying to group the following string into three groups.
0:0:Awesome:awesome
That being "0", "0" and "Awesome:awesome"
Using this regular expression:
^([0-9]+)\:([0-9]*)\:(.*)$
It works fine on online regex services: http://rubular.com/r/QePxt57EwU
But it seems like .NET doesn’t agree.
Picture of Regex problem from Visual Studio http://xs.to/image-3F8A_4BA916BD.jpg
The
MatchCollectioncontains the results of applying the regular expression to the source string iteratively. In your case there is only 1 match – so the results are correct. What you have are multiple captures within the match. This is what you want to compare against – not the number of matches.