Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
ECMAScript (JavaScript)

/
^(\d{5}-\d{4}|\d{5}|\d{9})$|^([a-zA-Z]\d[a-zA-Z]( )?\d[a-zA-Z]\d|[a-zA-Z]\d[a-zA-Z])$
/
i

Description

Formats can be like :

US: 80021 80021-4325

Canada: N8X 3T7 N8X

Submitted by Abdul Nasir - 8 years ago