From: 7stud -- Date: 2011-03-11T11:58:03+09:00 Subject: Re: Email parsing - help please Stuart Clarke wrote in post #986733: > Hi all, > > Imagine the following string of data containing > > d = "Bloggs Joe , Bloggs Keith > , Bloggs, Mary , > tim.bloggs@domain-a.com" > > As you can see the format of the email addresses is not consistant, for > that reason, I want to parse this string of data and seperated each > address with a pipe (|). It's always puzzling why people like you don't just list the output they want. For some reason you people feel a need to describe the output in words rather than just listing the string you want to end up with. d = "Bloggs Joe , Bloggs Keith , Bloggs, Mary , tim.bloggs@domain-a.com" arr = d.scan(/<([^>]+)>/).flatten result = arr.join('|') puts result --output:-- joe.bloggs@domain-a.com|keith.bloggs@domain-a.com|mary.bloggs@domain-a.com -- Posted via http://www.ruby-forum.com/.