Start a new topic

Regex Parse Last Name, First Name (note the comma!)

Hi, 


We have a field that includes 'last name, first name'. I want to separate the last and first names using regex. 


I can separate the last name from the first name however the comma stays with the last name. I need to drop the comma. 


Any thoughts on what expression to use? 


Thanks very much, 


Joshua


Joshua, can you share your current regex string?  Thanks, Dennis dennis@ladnierfamily.com

I just had this same issue a few days ago and found the answer in an Omatic blog:

https://omaticsoftware.com/blog/whats-in-a-name-separating-first-and-last-names-for-import-into-raisers-edge



The code I am using is as follows:

To split last name from 'last name, first name'

Replacement value = (?<=,).*

Values to match on = TRUE


When I test using Doe, John the replacement value renders exactly the same as the input value (i.e. Doe, John). 


Any help is appreciated. Thanks :)

To separate first name, I am using


.*(?<=,)

TRUE


Same result (i.e. output is no different than input). 


Is the RegEx box checked?

Most definitely :)

See attachment. 

Pictures are worth a thousand words! You want the .*(?<=,) to be the "Values to Match On" with a blank on Replacement Value side

Thanks! Unfortunately still getting errors. Two screenshots attached. 

Thanks so much,

Joshua



Did you type "BLANK" or just leave the field blank and click on the + sign?

left the field blank and clicked on the + sign

So strange! I've never seen it say blank in the test output! I'll set up the same dictionary and see if I can send it to you when it works.

that would be really helpful. Thanks!

First Name Dictionary works for me now..see attached. Both needed a little modification from what was posted on the forum blog I linked to earlier. The First Name dictionary as posted left a space before the name. The Last Name dictionary as posted left the comma after the last name. 

csv
(53 Bytes)
csv
(31 Bytes)

Thanks for sending the changes! 


It may be that I am not incorporating the TRUE FALSE but its not working for me. I am unclear how to incorporate those within the dictionary. 


I am attaching a screenshot of the current dictionary setup. Thoughts?


Thanks again

Login or Signup to post a comment