oops sorry put an 'e' after the regexp in the end Ramprasad A Padmanabhan wrote: > This may not be the best way But I wud work fine > > sub remove_space { > my($s)=@_; > $s=~s/\s+//g; > return $s; > } > > while(<FILE>){ > s/^(.*?)\s+(.*)$/$1.remove_space($2)/ > print; > > } > > > > > Panel Vincent - A53 wrote: > >> 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. > > >
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]