Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
\d{3}[\ ]?\d{3}
/
g

Description

This regex validates zipcode for India

Valid examples

  • 412003
  • 412 003

Invalid examples

  • 412-003
  • A412803
  • 45012
Submitted by Omkar Tapale - 7 years ago