Regex to transpose somewhat tricky last name, first name , title -


is possible use 1 regex convert both

doe, john c., jr., m.d. doe, jane, m.d. 

to read

john c. doe jr., m.d. jane doe, m.d. 

replace

^([^,]+),\s([^,]+),(?:(\s[^,]+),)?\s([^,]+)$ 

with

$2 $1$3, $4 

demo


Popular posts from this blog