Match multiline patterns? : Escape « Regular Expression « Perl






Match multiline patterns?

    
    #!/usr/local/bin/perl -w
    use strict;

    $/ = "";   # Paragraph mode

    while(<>) {
      print $1 if /(lines.*\n.*spaces)/s;
    }

   
    
    
    
  








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 the new line character
5.Skip blank lines and comments
6.Multiplies every integer in a file by 2