We need to write a regular expression which can accept a list of alphanumeric characters separated by single commas. The list can't start with the , but can end with a ,
Length of the characters will be from 1 to 9. So, considering following examples and their outcomes:
I have written the following regular expression:
Here, it is working fine for all the cases EXCEPT ONE i.e. it always expects the , in the end of the string. But, as per my requirement the string can end with a , or may not end with a , as well. I tried putting ,? but then it starts accepting more than 9 characters since it accepts 0 or 1 , between two entries.
Please suggest how to resolve this issue. Thanks in advance.