image2.jpg

Regular Expression Examples (REGEX)

On the Response Guides tab, under Text Bounds select “Format (meta-type)”.  Open the provided pop-list and select Custom.  This will enable a text box wherein Users can enter custom RegEx.

 

For additional Information:

http://msdn2.microsoft.com/en-us/library/1400241x.aspx

 

NOTE:Do not copy these formulas and paste them into the Survey Designer.  Manually type the formulas.

 

All formulas begin with “^” and end with “$”

 

Examples:

^\d$ = any one digit

 

^\d+$  = one or more digits

 

^\d*$ = one or no digits

 

^\d*\.\d\d$  = 1 digit, decimal, 2 digits, or just decimal followed by 2 digits, e.g. 3.23, or .45

 

^\.\d\d$ = period followed by 2 digits

 

^c\d\d$ = the letter C followed by two digits

 

^\d{3}.\d{1,2}$ = 3 digits followed by a period and then 1 or 2 digits

 

^(\d{1,3}|DK|RF|dk|rf|Dk|Rf|dK|rF)$ accepts a number with 1-3 digits, or the letters RF or DK (used if you have a text box in which you want to allow numbers, but also allow refuse to answer and don’t know).  The code allows for RF and DK to be upper or lower case.

 

Accepts 3 letters, lower or upper case (good for validating initials)

^([a-z][A-Z]{3})$

 

Accept digits 1-4 and 9

^([1-4]|9)$

 

Accepts 0-300, 888 or 999

^([0-9]|([1-9][0-9])|([1-2][0-9][0-9])|300|888|999)$

 

Accepts letter F, dash, three digits

^F\-[0-9]{3}$

 

Accepts 1-240, 888, 999

^(888|999|([1-2][0-3][0-9])|240|([1-9][0-9])|([1-9]))$

 

Accepts 0-200, 888, 999

^(888|999|([1][0-9][0-9])|200|([1-9][0-9])|([0-9]))$

 

Accepts 30-42, 99, 88

^(([3][0-9]|[4][0-2])|99|88)$

 

24hour time

^(([0-1][1-9])|(2[0-4])):[0-5][0-9]$

 

Accepts 0-100, 888, 999

^(0|[1-9]|([1-9][0-9])|100|888|999)$

 

Accepts 0-700, 888,999

^([0-9]|[1-9][0-9]|([1-6][0-9][0-9])|700|888|999)$

 

Accepts 28.0-42.0, 999, 888

^(([2][8-9].[0-9])|([3][0-9]\.\[0-9])|([4][1]\.\[0-9])|42.0|888|999)$

 

 

or login to the DatStat Customer Care portal and submit an inquiry.