How to write a C# Regex to ensure a string starts with one char followed by 6 digits -


i need write regex in c# ensure string starts 1 character of either s, r, or v, , has 6 following digits, this: "s123456". here regular expression i'm trying use:

@"(s|r|v)[0-9]{6}?"

but if pass string 1 many digits, "s1234567", fails. doing wrong here?

var regex = new regex(@"^[srv]\d{6}$"); 

Comments