fork download
  1. #!/usr/bin/perl
  2.  
  3. use strict;
  4.  
  5. my $s = "If the line was there is a loom in the gloom
  6. would you want that line printed?
  7. Just trying to understand if you're just
  8. other than as part of gloom
  9. if you really do want to exclude lines
  10. even when loom appears on it's own elsewhere on the line";
  11.  
  12. while ($s =~ /^.*?\bgloom\b(?!.*\n.*\n.*?\belsewhere\b).*\n.*\n.*\n?/mg) {
  13. print "$&";
  14. }
  15.  
Success #stdin #stdout 0.01s 5552KB
stdin
Standard input is empty
stdout
If the line was there is a loom in the gloom
would you want that line printed?
Just trying to understand if you're just