Your Ad Here

Sunday, May 25, 2008

Address: ZIP code (US) Reguler Expression





Address: ZIP code (US)


\b[0-9]{5}(?:-[0-9]{4})?\b


  • Assert position at a word boundary
  • Match a single character in the range between "0" and "9"
    • Exactly 5 times
  • Match the regular expression below
    • Between zero and one times, as many times as possible, giving back as needed (greedy)
    • Match the character "-" literally
    • Match a single character in the range between "0" and "9"
      • Exactly 4 times
  • Assert position at a word boundary


Created with RegexBuddy

No comments: