René Nyffenegger's collection of things on the web | |
René Nyffenegger on Oracle - Most wanted - Feedback
- Follow @renenyffenegger
|
Finding permutations [Perl] | ||
use warnings; use strict; my $str = "xyz WordOne foo bar WordThree bla bla WordFour so and so WordTwo now and then"; my $re = "((WordOne|WordTwo|WordThree|WordFour).*?){4}"; if ($str =~ /$re/) { print "Matched\n" } else { print "Didn't match\n" } |