Regular Expressions 101

CURP and RFC validator for Mexico — PortalFone

Open Workspace
  • PCRE2 (PHP)
  • Match
2

Regular Expression

/
^(?:[A-Z][AEIOU][A-Z]{2}\d{6}[HM][A-Z]{2}[B-DF-HJ-NP-TV-Z]{3}[A-Z0-9]\d|[A-ZÑ&]{3,4}\d{6}[A-Z0-9]{3})$
/
gm

Description

Validates Mexican CURP (18 characters) and RFC (12-13 characters) keys by format - the same check used by PortalFone's free validator.

Try it live: validador de CURP y RFC

PortalFone — guía independiente para docentes federalizados de México: calendario de pagos FONE, talones de pago, aguinaldo y trámites de Mi Portal FONE. No es un sitio oficial de la SEP.

Divulgación: formo parte de PortalFone, la guía enlazada.

Note: this checks the key's format only. It does not query RENAPO, SAT, SEP or other institutional databases, and it cannot confirm that a key exists or belongs to a particular person.

Submitted by PortalFone