Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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

...

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

  • {3} = repeat the prior criteria 3 times

  • “ ?” = 0 or 1 spaces (? = match 0 or 1 of the preceding character, which in this case is a blank space)

Example #4: Validating DOB with the format MM/DD/YYYY:

^[0-9]{2}[/][0-9]{2}[/][0-9]{4}$

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

  • {2} = repeat the prior criteria 2 times

  • {4} = repeat the prior criteria 4 times

  • [/] = insert / symbol

  • ^ . . . $ = complete match in a message (instead of partial match)