-
Regular Expressions
Anyone out there any good at regular expressions?
I need to check that an input only contains digits and is between 12 and 17 digits in length.
I thought \d{12,17} would work but it only ensures there are between 12 and 17 digits grouped together i.e. if you append or preppend (is that a word?) other characters then it slips through.
Help!
DJ
-
Re: Regular Expressions
Add a string start and end anchor to it:
^\d{12,17}$
(I think it's ^ and $, don't have regex here)
-
Re: Regular Expressions
Bang on Mr Frog!
Cheers
DJ
-
Re: Regular Expressions