Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
ECMAScript (JavaScript)

/
(?<=,\s*)(?:([A-Z])\.?[a-üA-Z{\\'}]*(?:(-)| )?)(?:([A-Z])(\.?)[a-üa-zA-Z{\\'}]*(?:(-)| )?)?(?:([A-Z])(\.)?[a-zA-Z{\\'}]*(?:(-)| )?)?(?= and|$)
/
gm

Description

Convert citation authors list from "Last_name, First_name" to "Last_name, F."

Submitted by Pierre Racine - 2 years ago