We're trying to create a regular expression, which must match the following strings:
- FOO-123123123123
- FOO123123123123
- FOO-123-123-123-123
It must satisfy the following conditions:
- string must begin with FOO
- symbols after foo may be only hyphens (optionally) and numbers
- there can't be more than one hyphen in a row
- the whole length of string can't be more than 50 symbols and less than 6
We've already came up with something like this
^FOO(-{0,1}[\d]+){6,50}$
but it seems like {6,50} sets limit of 50 not for total length of string, but for repeats of this capturing group
(-{0,1}[\d]+)
Can you please advice?