Regular Expressions 101

Community Patterns

regex my name (John D. Martin III)

0

Regular Expression
PCRE (PHP <7.3)

/
^J(ohn|\.(?= D\.)|(?= D )) D(aniel|\.)? Martin I{3}$
/
g

Description

If you are an academic whose name has a suffix on your name, then you'll have noticed that people are forever leaving it off. This regex checks all the different ways that I've seen my name spelled and matches on the acceptable spellings but not on everything else.

Submitted by twitter - 6 years ago