diff options
author | Rafael Garcia-Suarez <rgs@consttype.org> | 2009-10-23 00:22:16 +0200 |
---|---|---|
committer | Rafael Garcia-Suarez <rgs@consttype.org> | 2009-10-23 00:22:16 +0200 |
commit | 871673162d98aa63f3298e094e8afb43bc4230df (patch) | |
tree | 48659b5ac39b9dbaba329157f657370048e6335f /pod/perlretut.pod | |
parent | df052ff84a4fc5e49545a6877ffa22ba4d4e31db (diff) | |
download | perl-871673162d98aa63f3298e094e8afb43bc4230df.tar.gz |
[perl #69903] 5.10.1 perlretut section "A bit of magic: executing Perl code in a regular expression" documentation
The docs were now wrong, due to new optimisations to the regexp engine.
Diffstat (limited to 'pod/perlretut.pod')
-rw-r--r-- | pod/perlretut.pod | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pod/perlretut.pod b/pod/perlretut.pod index 22fc44a7b2..6c5c2e92a2 100644 --- a/pod/perlretut.pod +++ b/pod/perlretut.pod @@ -2474,11 +2474,11 @@ At first glance, you'd think that it shouldn't print, because obviously the C<ddd> isn't going to match the target string. But look at this example: - $x =~ /abc(?{print "Hi Mom!";})[d]dd/; # doesn't match, - # but _does_ print + $x =~ /abc(?{print "Hi Mom!";})[dD]dd/; # doesn't match, + # but _does_ print Hmm. What happened here? If you've been following along, you know that -the above pattern should be effectively the same as the last one -- +the above pattern should be effectively (almost) the same as the last one -- enclosing the d in a character class isn't going to change what it matches. So why does the first not print while the second one does? @@ -2487,7 +2487,7 @@ case, all the engine sees are plain old characters (aside from the C<?{}> construct). It's smart enough to realize that the string 'ddd' doesn't occur in our target string before actually running the pattern through. But in the second case, we've tricked it into thinking that our -pattern is more complicated than it is. It takes a look, sees our +pattern is more complicated. It takes a look, sees our character class, and decides that it will have to actually run the pattern to determine whether or not it matches, and in the process of running it hits the print statement before it discovers that we don't |