Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE2 (PHP >=7.3)

/
^(a[abefkmnrsvyz]|b[aegimnors]|c[aehorsuvy]|d[aevz]|e[elnostu]|f[afijory]|g[adlnuv]|h[aeiortuyz]|i[adegikostu]|j[av]|k[agijklmnorsuvwy]|l[abginotuv]|m[ghiklnrsty]|n[abdeglnorvy]|o[cjmrs]|p[ailst]|q[u]|r[mnouw]|s[acdegiklmnoqrstuvw]|t[aeghiklnorstwy]|u[gkrz]|v[eio]|w[ao]|x[h]|y[io]|z[ahu])$
/
gm

Description

Matches ISO 639-1 language codes.

Sourced from https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes

Submitted by Jason Whitehead - a year ago