use strict;
my $str = '\'one\',2,\'three\',\'hello\',\'xyz\',5,\'hello\',\'mnr\',\'hello\',\'axi\'
\'onae\',2,\'tree\',\'hello\',\'xyz\',6,\'hello\',\'mnr\',\'hello\',\'asd\'
\'onee\',2,\'xdsa\',\'hello\',\'xyz\',5,\'hello\',\'mnr\',\'hello\',\'aew\'
\'owne\',2,\'thr\',\'hello\',\'xyz\',3,\'hello\',\'mnr\',\'hello\',\'az\'
\'ocne\',2,\'tee\',\'hello\',\'xyz\',5,\'hello\',\'mnr\',\'hello\',\'zse\'
\'owne\',2,\'tre\',\'hello\',\'xyz\',2,\'hello\',\'mnr\',\'hello\',\'aai\'';
my $regex = qr/(.*?'hello'.*?),'hello',(.*)/p;
my $subst = '$1,0,$2';
my $result = $str =~ s/$regex/$subst/rg;
print "The result of the substitution is' $result\n";
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Perl, please visit: http://perldoc.perl.org/perlre.html