use strict; use warnings; my $data = 'func1(x, "%f", "hello")'; $data =~ s/ ( func1 \( x, \s \" ) % (.) "/$1text %$2 and %$2..."/ix; print ">$data<\n"; #### 19:23 >perl 1694_SoPW.pl >func1(x, "text %f and %f...", "hello")< 19:23 >