Mega Code Archive

 
Categories / Perl / Regular Expression
 

The s Operator and Substitution

The s operator is for substitutions.  The g stands for global change on a line.  Format s/old/new/; s/old/new/i; s/old/new/g; s+old+new+g; s(old)/new/;   s[old]{new}; s/old/expression to be evaluated/e; s/old/new/ige; s/old/new/x;