c:\@Work\Perl\monks>perl -wMstrict -le "use 5.010; ;; my $str = 'hello nr34,nr56,78, 98 , hi, 76'; print qq{'$str'}; ;; $str =~ s{ (nr\d+) }{calc($1);}xmsg; $str =~ s{ , \s* \K (\d+) }{ $1 * 4 }xmsge; print qq{'$str'}; " 'hello nr34,nr56,78, 98 , hi, 76' 'hello calc(nr34);,calc(nr56);,312, 392 , hi, 304'