помогите пожалуйста с регуляркой есть выр. [email protected][email protected]:25 представить в виде 216.12.200.131,25,[email protected],password спасибо
А зачем вам вообще регулярки? Непроще PHP: <?php $input = "[email protected]:[email protected]:25"; $dd = explode(":",$input); $email = $dd[0]; $cc = explode("@",$dd[1]); $pwd = $cc[0]; $ip = $cc[1]; $port = $dd[2]; echo "$ip,$port,$email,$pwd"; ?>
Code: use strict; use warnings; my $str = '[email protected]:[email protected]:25'; $str =~ s/^(\S+?@\S+?):(.+?)\@((?:\d{1,3}\.){3}\d{1,3}):(\d{1,5})$/$3,$4,$1,$2/; print $str;