Reputation: 31
I need to find a serial number that is split with "~"
characters and it may have from 10 to 30 letters in it.
Currently I am using this regex pattern: "~[A-Z]~[A-Z]~[A-Z]~[A-Z]~[A-Z]~[A-Z]~[A-Z]~[A-Z]~[A-Z]~[A-Z]"
.
I need to change to it, so that it would search not only 10 letters, but any count up to 30.
Upvotes: 0
Views: 73
Reputation: 6852
(~[A-Z]){10,30}
This should match any number of repetitions from 10 to 30.
(It is greedy by default, so it will match the longest possible string.)
Upvotes: 1