Regular Expressions 101

Community Patterns

Names with hyphens or single quotes

1

Regular Expression
PCRE (PHP <7.3)

/
^[a-zA-Z]+[\'-]{0,1}[a-zA-Z]+$
/
i

Description

Names that accept maximum of 1 hyphen or 1 Quote, does not allow white spaces, allows an unlimited length of name.

Submitted by chakra_tavy - 8 years ago