Today I managed to get a straightforward explanation for something which has always looked like gobbledy-gook to me i.e. Regular Expressions. So I thought I would share what I've picked up so far and add more as and when I get my head round this stuff.
So here's an example regular expression:
^\d{2}$
This would restrict input to numeric values only and two characters maximum length.
^ = start
\d = numbers only
{2} = how many
$ = end
There is a very useful regular expression testing tool here
Let's say you want numbers only i.e. no numbers or only numbers.
^\d*$
No comments:
Post a Comment