regex: simplify the {,} repetition parsing logic