topical media & game development

talk show tell print

basic-regex-26-NegativeLookAhead.pl / pl



  #!/usr/bin/perl -w
  use strict;
  print "This tests negative lookahead.\n";
  print "Enter a test string here: ";
  my myTestString = <STDIN>;
  chomp(myTestString);
  if (myTestString =~ m/Star(?! Training)/)
  {
   print "There was a match which was '&'.";
  }
  else
  {
   print "There was no match.";
  }


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.