vb.net - Regex to check if string is alphanumeric separated by commas or a single alphanumeric string -
i have following right works fine if string alphanumeric , separated commas, doesn't work if have single string.
"^([a-za-z0-9]+,)+[a-za-z0-9]+$"
works "1a,1b,1c", doesn't work on "1a"
sorry, don't know regex , got through searching.
here few example of can valid or invalid
1 - valid
12 - valid
1a - valid
a1 - invalid
12a - valid
a12 - invalid
1aa - invalid
a - invalid
1,2,3,6a,6b,11,11a - valid
invalid if other characters appear in string except numbers , letters no commas or in prefix , suffix
Comments
Post a Comment