Page 1 of 1

Parsing names from email address book

PostPosted: Fri Jan 06, 2006 12:20 pm
by bowensvt
I am trying to find the best way to pull names from an email address export file. The names are exported and look like this:
"John Smith" <[email protected]>
I want to place the data into first name, last name , and email fields. I've been playing around using patterncount but an going in bigger and bigger circles. Any help will be most appreciated.

Bob O

Re: Parsing names from email address book

PostPosted: Fri Jan 06, 2006 1:26 pm
by John Sindelar
bowensvt wrote:I am trying to find the best way to pull names from an email address export file. The names are exported and look like this:
"John Smith" <[email protected]>
I want to place the data into first name, last name , and email fields. I've been playing around using patterncount but an going in bigger and bigger circles.


My mind goes to Substitute() instead of Patterncount(). The following is set to return Email, but you can use it to extract any of the variables declared in the Let() statement. Kind of crude on middle names, but you get the idea.
Code: Select all
Let ( [
string = YourFieldName ;
sName = Substitute ( Left ( string ; Position ( string ; "<" ; 1; 1 ) - 1 ) ; """ ; "" ) ;
sNameFirst = LeftWords ( sName ; 1 ) ;
sNameLast = Substitute ( sName ; sNameFirst & " " ; "" ) ;
sEmail = Substitute ( string ; [ "<" ; "" ] ; [ ">" ; "" ] ; [ """ ; "" ] ; [ sName ; "" ] )
] ;

sEmail

)