In String-type Data Items input controls can be set with regular expressions. These are examples of control formulae for phone numbers, email addresses, etc.
Zip Code
Input Samples | Restriction | Control formula in Regular Expression | |
---|---|---|---|
1234567 | 7 digit number | [0-9]{7} | (Indicating 2 samples. Means the same.) |
\d{7} | |||
123-4567 | 3 digit number dash 4 digit number | [0-9]{3}-[0-9]{4} | (Indicating 2 samples. Means the same.) |
\d{3}-\d{4} |
Phone number
Input Samples | Restriction | Control formula in Regular Expression | |
---|---|---|---|
0123456789 | 10-11 digit number begins with "0" | 0[0-9]{9,10} | |
012-345-6789 01-2345-6789 0123-456-789 |
2-5 digit number begins with "0" dash 1-4 digit number dash 3-4 digit number | 0[0-9]{1,4}-[0-9]{1,4}-[0-9]{3,4} | Better when 12-13 characters limit is set. |
Date
Input Samples | Restriction | Control formula in Regular Expression | |
---|---|---|---|
2014-12-25 | 4 digit number begins with "20" dash 2 dgit number dash 2 digit number | 20[0-9]{2}-[0-1][0-9]-[0-3][0-9] | |
4 digit number begins with "20" dash 2 dgit number (01-12) dash 2 digit number (01-31) | 20[0-9]{2}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1]) |
Email Address
Input Samples | Restriction | Control formula in Regular Expression | |
---|---|---|---|
sample@sample.com | Alphanumeric Repetition of alphanumeric includes 4 symbols of "_.-+" At symbol Repetition of alphanumeric includes 2 symbols of ".-" | [a-zA-Z0-9][a-zA-Z0-9_\.\-+]*@[A-Za-z0-9\.\-]+ | Allows repetition of "dots" |
(In addition to the above)Ends with either of “.com” “.net” “.org” “.jp” | [a-zA-Z0-9][a-zA-Z0-9_\.\-+]*@[A-Za-z0-9\.\-]+\.(com|net|org|jp) | Detects an obvious clerical error such as ". Coom" ". Jpn", etc. but many top-level domains are not listed. |
URL
Input Samples | Restriction | Control formula in Regular Expression | |
---|---|---|---|
http://www.questetra.com/ | Begins with “http://” or “https://” Repetition of alphanumeric includes 4 symbols of "_.-+" / | (http|https)://[A-Za-z0-9_\.\-+]*/? | |
Begins with “http://” or “https://” Repetition of alphanumeric includes 15 symbols of "_.-+"_/:%#$&?()~.=+-” | (http|https)://[A-Za-z0-9_/:%#\$&\?\(\)~\.=\+\-]+ | (Indicating 2 samples. Means the same.) | |
https?://[A-Za-z0-9_/:%#\$&\?\(\)~\.=\+\-]+ |
Comments
0 comments
Article is closed for comments.