Regular Expressions 101

Community Patterns

firstname and lastname

1

Regular Expression
PCRE (PHP <7.3)

/
(.*?)\s([\wáâàãçéêíóôõúüÁÂÀÃÇÉÊÍÓÔÕÚÜ]+\-?\'?\w+\.*?$)
/
gmi

Description

Passed for all the names below: firstname middlename Müller Boromir Stark Amy Senn James Murphy Peter Bauman Tivon Moffitt John Paul Mulhern Bob Pounds Tim Prinsen Steven L. Timmel Jeffrey E. Johnston Christopher B. Pro... Anthony Lunceford Joe Massa Mathias d'Arras Martin Luther King Jr. Hector Sausage-Hausen Martin king, Jr. ANDA IVANOVA-KRIVONOGOVA Clooney George Timothy William Pitt Bradley STEVE SMITH Stev3 Smith STeve Smith Steve SMith Steve Sm1th d'Are to Beaware Jo Blow Hyoung Kyoung Wu Mike O'Neal Steve Johnson-Smith Jozef-Schmozev Hiemdel O Henry Smith Mathais d'Arras Martin Luther King Jr Downtown-James Brown Darren McCarty George De FunkMaster Kurtis B-Ball Basketball Ahmad el Jeffe Ronan Ramón O'Gara

Submitted by Ellen Higashi - 8 years ago