Reputation: 142
I have input where ppl write : PESEL:PESEL:PESEL... Pesel is a number with 11 digits like 99040810123.
Now i have 123456789123:123456789123:123456789123:123456789123 How can i check with regular expression is it correct? A fixed amount of PESEL is not provided.
I tried /^\d{11}:/g
but it didn't work with last number.
Upvotes: 3
Views: 1286
Reputation: 1915
This should work:
/^\d{11}(:\d{11})*$/
The Regex allow 1 or multiple 11 character long numbers which are :-separated.
Upvotes: 4