I'm trying to create a python regex for "one or two digits numbers sequences separated by optional multiple spaces or an optional single comma."
For example:
" 1" Should tests good
" 1 2 3 3 4 5 7 17" Should test good
" 1, 2,3,11,74" Should test good
"1,11,14, 15" Should test good
"111, 101" Should not test good
"1 2 3 a" Should not test good
"1, 25, 5.0 " Should not test good
"1,, 7, 80" Should not test good
"1,11,14," Should not test good
Comma signs should only appear between numbers (or white spaces). That's why last example shouldn't test good.
I tried with this:
^\s*\d{1,2}(\s*\,?\d{1,2}\s*\,?)*\s*$
But got not good results, for example "11111" would test good. How should I write my regex?