0

I am trying to use regular expression to validate input such as:

aa,bb,c1  or T1

basically a comma separated string and each item should be at most 2 character long.

This is what I come up with:

^([a-z0-9\s]{2}+,)*([a-z0-9\s]{2}+){1}$

I tried in regex101 and it does want I want. However, when I put this into c#, it throws Nested qualifier exception.

I admit that my knowledge of regex is low, can anyone point out what kind of regex expression should I write for c# world?

daxu
  • 3,514
  • 5
  • 38
  • 76

0 Answers0