Regular Expressions 101

Community Patterns

Shorten Names: Delete everything but the First and Second Last Name

0

Regular Expression
PCRE (PHP <7.3)

/
^(\p{L}+?\s)(\p{L}+?\s).*(,.*$)
/
g

Description

Useful for deleting extra last names before a comma.

Submitted by mglezsauri@gmail.com - 7 years ago