Validations in text questions
Text questions in Effect IO can be validated on the fly using Regex patterns. Regex patterns are highly flexible and quite hard. So for your reference, here are some common patterns you can paste into the validations in text questions
Numbers & Currency:
- A number 1-4 digits in length: ^\d{1,4}$
- A whole number percentage with '%' sign: ^\d{1,3}\%$
- A whole number or up to two decimal places: ^\d+(\.\d{1,2})?$
- Currency (Dollars and Cents with commas): ^\$?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,} (\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$
- Currency (Euros with periods and comma): ^\€?([1-9]{1}[0-9]{0,2}(\.[0-9]{3})*(\,[0-9]{0,2})?|[1-9]{1}[0-9]{0,} (\,[0-9]{0,2})?|0(\,[0-9]{0,2})?|(\,[0-9]{1,2})?)$
- Currency (French with spaces and comma): ^\€?([1-9]{1}[0-9]{0,2}(\s[0-9]{3})*(\,[0-9]{0,2})?|[1-9]{1}[0-9]{0,} (\,[0-9]{0,2})?|0(\,[0-9]{0,2})?|(\,[0-9]{1,2})?)$
- Range of number 0..999: ^([0-9]|[1-9][0-9]|[1-9][0-9][0-9])$
Contact Info & Demographics
- Email Address Format: ^([a-zA-Z0-9_\-\.]+)*(\+[a-z0-9-]+)?@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$
- US Phone Number: ^((\(\d{3}\) ?)|(\d{3}[-\s]))?\d{3}[-\s]\d{4}$
- US Zip Code 5 or 9 digit (w/ dash): ^\d{5}([\-]\d{4}){0,1}$
- Age in Years (Max 122): ^([0-9]|[1-9][0-9]|[1-9][0-1][0-9]|[1-9]2[0-2])$
- Height in Feet and Inches e.g. 6'3" or 6' 3": ^([1-8]')?\s?([1-9]|1[01])
Dates & Times
- Three character Month: ^Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sept|Oct|Nov|Dec$
- Date in mm/dd/yyyy: ^(0[1-9]|1[012])[\/](0[1-9]|[12][0-9]|3[01])[\/](19|20)\d\d$
- Date in mm/dd/yyyy or m/d/yyyy: ^(0?[1-9]|1[012])[\/](0?[1-9]|[12][0-9]|3[01])[\/](19|20)\d\d$
- Date in dd/mm/yyyy: ^(0?[1-9]|[12][0-9]|3[01])[\/](0?[1-9]|1[012])[\/](19|20)\d\d$
- Date in yyyy/mm/dd: ^(19|20)\d\d[\/](0?[1-9]|1[012])[\/](0?[1-9]|[12][0-9]|3[01])$
- Time Format in HH:MM am/pm: ^([1-9]|1[012]):(0[0-9]|[1-5][0-9])\s?(am|AM|pm|PM)$
Web & Email
- Email Address Format: ^([a-zA-Z0-9_\-\.]+)*(\+[a-z0-9-]+)?@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$
- MAC Address: ^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$
- IP Address: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
Related Articles
Charts in report editor
Currently, the Effect IO report editor is in its infancy, so setting up charts requires some work. After you have created a report, you can navigate to a page, and add the "chart" component. Here, you will be able to the JSON configuration of a ...
Working with surveys
The Effect IO survey editor is the core of the system. A general overview on how to work with surveys follows. We assume that you have created a new survey and have entered the survey editor. You can also learn more about survey settings here. About ...
Opening CSV-files
Excel The CSV format is not straight forward to open in Excel. To do this, you need to first open a new spreadsheet. Next, import the file from the file-menu option. It is important that you select CSV as file type, file origina as UTF-8, (only) ...
Computed variables
Calculate variables are used for calculating indexes or variables based on a respondents answer to multiple questions. The variables are set for each survey, and can be reused in all reports using this survey. You find the computed variables by ...
Javascript (JS) question - store and retrieve values
The Javascript question is in itself not storing any data in the survey. To store and retrieve respondent actions, you need to implement the following code in your javascript To store data from javascript: ...