Home >> perlregex >>
Perl regex substitutionYou can use the =~ and !~ operations to perform substitution. The operator for this operation is s///. #!/usr/bin/perl
$string="aabcdefghiabc";
$string=~s/abc/123/;
print $string; If you execute this code, the string a123defghiabc will be printed. Options
$string=~s/abc/123/g; option g will replace all occurances of 'abc' $string will now become 'a123defghi123';
Perl functions
|
Perl regex (Regular expressions) examples
Download perl
download stable version of perl
Perl 5.10.1
|
|