in reply to replacing email id using regex
The .+ is greedy by default. Non-greedy: .+?. Do you really have a space char at the beginning of the line? Why do you include spaces in your search pattern?
$_ =~ s/(.+?\@)(.+?\.)(.+?)/$1something.$3/g;
Without captures, using look-behind and look-ahead:
$_ =~ s/(?<=\@).+?(?=\.)/something/g;
See perlre.
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|