I want to validate comma separated string using regex.
My sample inputs
hello,hi,hey,there,where - Valid
hello hi,hey there,hey,hi - InValid(space between word should invalid)
hello,hi,hey,there,where, - Invalid - Comma at end
,hello,hi,hey,there,where - Invalid - Comma at beginning
hello,hi,,hey,there,where - Invalid - No value between 2,3 comma
I tried using this regex [0-9a-zA-Z]+(,[0-9a-zA-Z]+)* but its now working for every cases.
>Solution :
just like this: ^[0-9a-zA-Z]+(,[0-9a-zA-Z]+)*$