Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Regular expressions are characters used to define a search pattern. They can be used to enhance existing W2H functionality. Go here and select the cheatsheet on the left panel to learn how regular expressions can be built and used. The webpage allows you to build a regular expression underneath the expression header. You can input a variety of test cases below the text/test header separated by rows (press enter) to see which cases are included in or found by the regular expression.

Example #1: Validating that a participant selects a reminder to occur between 9am-9pm (inclusive)

  • . = any character except a line break

  • * = zero or more instances of the preceding character

  • | = “or”

The regular expression in the example above validates the union of the four pieces of logic:

  • 09:.* validates 09:00-09:59

  • 1.:.* validates 10:00-19:59

  • 20:.* validates 20:00-20:59

  • 21:00 validates 21:00

Note: the regular expression as written validates many other non-numerical inputs such as 09:GD, etc., but because the input type is Time (see above) and is limited to numerical inputs, this is not a problem.

Example #2: Validating that a participant inputs a zip code that is 5 numbers ranging from 0-9:

([0-9]{5})

  • [0-9] = a char in range 0-9 (inclusive)

  • {5} = repeat the prior criteria 5 times

  • No labels