Regular Expressions 101

Community Patterns

Simple ID verification

1

Regular Expression
PCRE2 (PHP >=7.3)

/
^[a-zA-Z0-9 ]{6,30}$
/
gm

Description

Used to validate documents identifiers like passports and IDs, VISA numbers.

  • Default to 6 characters min and max 30 characters for format tin-no, such as the Tax regisration number.- Regular Expression
    ^[a-zA-Z0-9 ]{6,30}$
    
  • Accepts both lowercase and uppercase letters, from a-z, digit, and white space.
  • NOTE: Double white space between characters not validated.
Submitted by Sowed Castelli - 3 years ago