Reputation: 13
The problem I'm having is, I don't want to match to have a comma preceding the first match number..
Ex: "1,2,3 <?>"
and "0,9,1,2 <?>"
What I have now is @"\d,\d,\d\s*<?>"
and It returns this "1,2,3 <?>"
and "9,1,2 <?>"
. It shouldn't get the "9,1,2 <?>"
because it has a 0,
in front... How do I exclude this match?
Upvotes: 0
Views: 51
Reputation: 70732
Use the beginning of string ^
and end of string $
anchors and escape the ?
metacharacter.
@"^\d,\d,\d\s*<\?>$"
Upvotes: 2