I need some help writing a regular expression that matches this:
- an opening square bracket OR number as first character
- a closing square bracket (if there was an opening square bracket) OR number (if the opening was a number) as the last character
- at least one comma separating two numbers without a space, and if there are more commas, they must be seperating numbers without spaces
Example matches:
- 1,1
- [1,1]
- [1,1,2,3]
Not matches:
- [1,1
- 1, 1
- [1, 2,2]
- [1,2,]