Regular Expressions 101

Community Patterns

1...56789...900

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
^(?!.*[@\.\_\d])[A-Za-z\x{00C0}-\x{00FF}][A-Za-z\x{00C0}-\x{00FF}\'\-]+([\ A-Za-z\x{00C0}-\x{00FF}][A-Za-z\x{00C0}-\x{00FF}\'\-]+)*
/
gmu

Description

Regular expression taken from the following tutorial: https://andrewwoods.net/blog/2018/name-validation-regex/

I added the first part of the expression (?!.*[@._\d]) in order to not allow @ . _ and numbers cause I discovered a little weakness on the original expression.

Thanks to Andrew Woods

Submitted by anonymous - 5 years ago