in reply to RE's and multiple modifiers...
Furthermore, not only are multiple modifiers allowed in Regular Expressions, but with "Extended" regular expressions, those modifiers can be applied to "parts" of regular expressions, like:
Now that is cool.#!/usr/bin/perl -w use strict; # 0 0 1 0 1 my @words = qw, eLBow ElBow elBoW eLbow elboW,; # I want to match all words elbow # whose W is capital, and e and o e are in lower case # and but l and B can be either case # There are two ways to do it for(@words) { printf "%s\n",$_ if /e(L|l)(B|b)oW/; } ##or using Extended Regular Expressions for(@words) { printf "%s\n",$_ if /e(?i-:lb)oW/; } __END__ # the output elBoW elboW elBoW elboW
___crazyinsomniac_______________________________________
Disclaimer: Don't blame. It came from inside the void
perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;"
|
|---|