fork download
  1. #!/usr/bin/perl -w
  2.  
  3. use strict;
  4. use warnings;
  5.  
  6. while (<DATA>) {
  7.  
  8. # \1/ Starting at the beginning of a string or non-word character,
  9. # \2/ MATCH a single-quote character followed by a character that is
  10. # *not* a single quote character,
  11. # \3/ And continue matching one or more times:
  12. # - a white space character,
  13. # - a word character,
  14. # - a comma,
  15. # - or a single-quote that is followed by a lower-case 's' or 't'.
  16. # \4/ And END the match on a single quote.
  17. # \5/ Continue searching for additional matches.
  18.  
  19. my @matches = /(?:\A|\W)('[^'](?:\w|\s|,|'(?=[st]\b))+')/g;
  20.  
  21. # \___1___/\__2_/\___________3__________/4/\5/
  22.  
  23. print join("\n", @matches), "\n";
  24. }
  25.  
  26. __END__
  27. 'At the Beginning' ABC released its full midseason schedule today, and it features premiere dates for several new shows, along with one rather surprising timeslot change.</p><p>First of all, ABC's previously reported plans for dramas 'Once Upon A Time,' 'Revenge,' 'Grey's Anatomy,' and 'Scandal' haven't changed.
  28.  
  29.  
Success #stdin #stdout 0s 3696KB
stdin
Standard input is empty
stdout
'At the Beginning'
'Once Upon A Time,'
'Revenge,'
'Grey's Anatomy,'
'Scandal'