Match the new line character : Escape « Regular Expression « Perl






Match the new line character

    


$_ = "This text\nhas multiple lines.";
s/^/BOL/g;
s/$/EOL/g;
print;

   
    
    
    
  








Related examples in the same category

1.A word-count program that handles multiple spaces and tabs between words.
2.Escape Sequences for Special Characters
3.Escape sequences, \n and \t
4.Match multiline patterns?
5.Skip blank lines and comments
6.Multiplies every integer in a file by 2