Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
ECMAScript (JavaScript)

/
^([A-Z][a-z]+([ ]?[a-z]?['-]?[A-Z][a-z]+)*)$
/
gm

Description

Validates a first or last name of an user.

Positives: Anna Anna-Louisa Anna Louisa

Negatives anna anna01 Anna louisa Anna&

Submitted by Iris - 3 years ago