tags:

views:

26

answers:

2
input:    name <[email protected]>; hans@dhdfhgdfgh <hans.dampf@xxxx>; 
Output:   [email protected], [email protected], [email protected],[email protected]

So basically I have to erase the stuff between: >;(?*)< But my regex isn't working. can anyone help me?

Simon

A: 

If >;(?*)< is the Regex you tried, then the question mark is probably wrong. It has no special meaning. Try using >;(.*)< instead and see if thats what you wanted.

Jens
big thank Jens but i found a even nicer way to do it:search for **(.*)<(.*)>;** and replace it with \2
Simon
@Simon: You should probably replace `.` with `[^<>]` in both cases to avoid accidentally replacing whole email entries.
Jens
A: 

you should go another way. Instead of filtering the decoration you should write a regex, that matches only email addresses. Get the result as an array and join it with ", "

To find valid emails there are plenty of expressions out there. More ore less accurate. http://regexlib.com/Search.aspx?k=email

SchlaWiener
*To find valid emails there are plenty of expressions out there.* -- You mean like [this one](http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html)?
Andy E
Yepp, I once used this regex in a presentation as a good example of how to not use regex ;) my favorite is: .+@.+(\.\w{2,4}) Not very accurate but simple.
SchlaWiener