Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
ECMAScript (JavaScript)

/
([A-Z])\w+\s([A-Z])\w*\s*([A-Z])*(?=,*)
/

Description

Matches 2 or 3 initials from a name. If there is a "," and suffix like Jr., it does not include that in the result.

Submitted by Brad M. - 9 years ago