> Why not splitting on whitespaces and joining the pieces together ? E.g.
Because it won't work : "michael mac douglas" will give "[EMAIL PROTECTED]" not "[EMAIL PROTECTED]" Vincent. > -----Original Message----- > From: Thorsten Dieckhoff [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, September 18, 2002 2:47 PM > To: Panel Vincent - A53 > Subject: Re: Regexp > > > > I have a problem with a regular expression : > > > > I process a text file with a list of names. > > > > I would like to reformat names like > > > > Francois de la Varenne > > Macha Meril > > Buzz Mac Cormack > > > > (there must be at least two words in the name) > > to something like this : > > > > [EMAIL PROTECTED] > > [EMAIL PROTECTED] > > [EMAIL PROTECTED] > > > > In other words : "[EMAIL PROTECTED]". > > > > I tried the following thing and it doesn't work ($name already > contains one > > of those names) : > > > > $name=~s/\s*(\w+)\s+(\w+)(\s+(\w+))*\s*/$1.$2$3\@domain.top/ > > > > > > Does anyone knows the right regexp to do this (I guess it's the > second > > expression with $s which is wrong) > > > > Vincent Panel. > > Hi, I assume you have one full name per line - why not splitting on > whitespaces > and joining the pieces together ? E.g. > > @names = split(/\s/, $line); > $fullname = join('.', @names) . '@my.domain.foo'; > > HTH, Thorsten ! > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]