in reply to passing qr//'d regexp via Perl/Tk Entry widget
It is only by chance that (?-xism:foo) matches "foobarbaz" - it has nothing to do with the fact that this is the string representation of the regular expression qr/foo/. The "(?-xism:" signals the start of a non-capturing grouping with the x, i, s and m modifiers turned off. This little construct is buried within perlre. I can't say I ever realized that the stringification of a regular expression is itself another related, similar regular expression. Update: Boy do I feel like a fool! Whenever Perl printed (?-xism:the regex), I always read it as "Regular expression-ism: 'the regex'". As in "The United States' policy was one of protectionism". I never realized Perl was being helpful and showing me the modifiers it was (or wasn't) using.$string =~ eval $exp ? print STDOUT "match!\n" : print STDOUT "No matc +h!\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: passing qr//'d regexp via Perl/Tk Entry widget
by young_stu (Beadle) on Jun 23, 2005 at 23:13 UTC | |
by crashtest (Curate) on Jun 23, 2005 at 23:42 UTC | |
by young_stu (Beadle) on Jun 24, 2005 at 00:23 UTC |