Code Soup

Drag the pieces of the code below and put them in the right order to construct the correct regular expression for validating a zip code. A zip code should have at least 5 digits (12345). However, it may also be in the format #####-####.

  • /
  • ^
  • \d
  • {5}
  • (
  • -
  • \d
  • {4}
  • )
  • ?
  • $
  • /