This regex will work for you Test Given Regex
^\d{1,2}+[a-zA-Z]?+(?:,\d{1,2}+[a-zA-Z]?)*$
Define ^\d{1,2}+[a-zA-Z]?
\d : Represent a digit 0-9
{1,2} : Minimum 1 and Maximum 2 Of previous Expressions
\d{1,2} : Means 1 to two digits
+ : Previous Expression Repeats From one to unlimited times
[a-zA-Z] : Range Defined for all capital And Small latter [a-z] for small Latter, [A-Z] Capital: latter
? : Repeat Previous Expression 0 or one Times
[a-zA-Z]? : One/Zero Charter from "a to z ,A to Z"
^\d{1,2}+[a-zA-Z]?
: Start with one or two digits and an optional character
Define (?:,\d{1,2}+[a-zA-Z]?)*$
?: : Non Capturing Group,Match zero to unlimited times//Reference link given Below
, : Match Comma(Given Character must be comma)
\d : Represent a digit 0-9
{1,2} : Minimum 1 and Maximum 2 Of previous Expressions
\d{1,2} : Means 1 to two digits
+ : Previous Expression Repeats From one to unlimited times
[a-zA-Z] : Range Defined for all capital And Small latter [a-z] for small Latter, [A-Z] Capital: latter
? : Repeat Previous Expression 0 or one Times
[a-zA-Z]? : One/Zero Charter from "a to z ,A to Z"
* : Match Previous Expression Between zero and unlimited times, as many times as possible
$ : End of Regex
(?:,\d{1,2}+[a-zA-Z]?)*$
: Start with comma then one or two number/digitd then one character from range a-zA-Z
This Expression Match from 0 to ultimate times and the end of regex
^\d{1,2}+[a-zA-Z]?+(?:,\d{1,2}+[a-zA-Z]?)*$
: Start with (one or two) Digit , Followed by one character,
Start next expression (one comma 1-2 digits and an optional Character ) and match it 0 to unlimited times as meany times as possible Before End of string
- Check online Regex Test
- Reference : Non Capturing Group