Using regular expressions

Regular Expressions must start and finish with a forward slash ("/"). You can find a good library of regular expressions at http://www.regexlib.net/. These patterns will almost always work if they are surrounded by forward slashes.

To test your regex you can use this regex tester.

=Important: Regular Expressions in conditions=

Note that when using regular expressions in the condition editor, do NOT include the beginning and ending slash.

=Email validation=

Update (12/2018): Since these days domain names cannot only hold special characters like “ü” but also use more than 3 characters as domain name like .tech or .company, the below email regex only checks if “@” and “.” exists within the entered email address. At this outdated regex the domain name is limited to 3 characters which doesn't cover all available domains:

=Postcodes=

US postal codes
For the postal code to start with zero, use:

UK postcodes
Note that this is not very exact, and a more exact validation is much more complex. For example, see StackOverflow answer and Wikipedia for more information.

French postcodes
The above expression is very precise and it will check whether or not the French Department exists (first two digits), including overseas Departments and overseas Territories (DOM-TOM).

=Phone numbers=

US phone numbers
or

This second option will match all phone Canadian and US phone numbers that include non-digit symbols including:

This will allow you to match phone numbers which resemble below:
 * (555)555 5555
 * 555.555.5555
 * 555 555 5555
 * (555)-555-5555
 * 555-555-5555
 * 555555555

Australian phone numbers
The following patterns match all various Australian mobile and landline phone numbers including with "+61" country prefix:
 * (02) 9123 6535
 * 03 1234-5345
 * 0412 345 678
 * +61 2 3456 789

But not:
 * 234 3450 234
 * a234 534 3432
 * 134567
 * 123456789013

Brackets, white space and hypens are ignored.

The 'Very precise:' versions listed here match against the first four or five digits in a number to ensure that they are valid Australian numbers.

The 'Not very precise:' only match against the first and second digit so may allow invaid numbers.

All Australian phone numbers (mobile and landline - area code required)
Very precise:

Not very precise:

All Australian phone numbers (landlines only - area code required)
Very precise:

Not very precise:

New South Wales landline phone numbers (area code optional)
Very precise:

Not very precise:

Victorian and Tasmanian landline phone numbers (area code optional)
Very precise:

Not very precise:

Queensland landline phone numbers (area code optional)
Very precise:

Not very precise:

South Australia, Northern Territory, Western Australia landline phone numbers (area code optional)
Very precise:

Not very precise:

Australian mobile phone numbers only
Very precise:

Not very precise:

Luxemburg mobile phone number
=German marks (with optional plus or minus)=

=Age validation=

Example: Age 20-99

Example: Age 18-35

Example: Age 19-65

=Number validation=

Numbers from 1 to 999, 1.000 to 999.999 to 999.999.999
Accepts numbers from 1 to 999, 1.000 to 999.999 to 999.999.999 but rejects numbers like 999.1.1, 94.22.22, 999.1.22, 999.11.1, 999.1.333

Number validation with optional decimal (for price)
Accepts numbers from 0 to 199, with 2 decimal optional:

Number validation with thousand separator
Space as separator, no minus Dot as separator, minus allowed

It forces two decimal points and accepts numbers from 1.00 to 999,999,999.00 with an optional comma delimiting thousands/millions including all of the following: 1.00, 1,000.00, 12,345.67, 12345,02, 123,456,468.00, 1234566.00, 123456789.00 but not 1,23.00, 12,3.4 or 1234,43.04 Similar to the above: Forces two decimal points but accepts a "0" before decimal separator ",".

Same as above, but the two decimal points are optional:

Month (1-12)
If you want to ask for the month a person was born you can validate the input as follows:

=Minimum width (set to 3 in this example)=

=Currency=

US currency (dollar sign and cents optional)
Check for comma usage:

Swiss price
A number with two decimal numbers after the decimal point of which the last one is either a 5 or a 0:

=Validate score=

1-100
=Text validation=

The multiple short text question type doesn't support minimum or maximum answers at the moment. One way around this is to use a long free text question type with a regular expression.

The below expression tests for at least one word per line for at least 3 lines and no more than 10 lines:

If you want, say five words per line, you could change the first and last star/asterisk to {4,}:

If you wanted one or more words per line (between line 1 and line 5), you can change the content located within the last curly braces to 0,4 (note you use 0 because you're already matching the first line).

Word count
The following restricts the number of words allowed to a minimum of 1 and a maximum of 200:

To increase the minimum change the zero part of {0,199}.

To increase or decrease the maximum change the "199" part of {0,199}.

=Time validation=

There are a number of ways to write time formats. Some of the possible options are 12 hour or 24 hour, with seconds or without. Although it is an option to use the date question type (it can also capture time) you can use the short free text question type with one of the below validation regular expressions.

The following three validation strings test for 24 hour time (in order of appearances) without seconds, with optional seconds lastly with seconds required:

The following three match 12 hour time, as above with seconds, optional seconds and with seconds required:

The following three match either 12 or 24 hour time as above with seconds, optional seconds and with seconds required:

=US states=

To validate for one state use the following (example is Texas):
 * TX uppercase only:
 * tx lowercase only:
 * TX upper or lowercase:

=Profanity Filter=

To filter profanity words from an answer:

Replace "ENTERPROFANITYHERE" with your bad word.

The \b will allow passing of words such as "assassination" and "hello" if you enter "ass" or "hell" as your profanity word. This also works if you are trying to omit other words, names etc. from answers.

=Helpful links=

In the beginning of this wiki section, we recommend you to use https://regex101.com/ to test/create regular expressions. You can also use https://www.regextester.com/ to create expressions in case you are unhappy about the first option.