From: Rafael Garcia-Suarez Date: Fri, 17 Nov 2006 09:45:56 +0000 (+0000) Subject: Doc nits to re.pm X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=432acd5fa9704890f9e1c4b3810c56daa9b791a3;p=p5sagit%2Fp5-mst-13.2.git Doc nits to re.pm p4raw-id: //depot/perl@29300 --- diff --git a/ext/re/re.pm b/ext/re/re.pm index 4123416..ce01214 100644 --- a/ext/re/re.pm +++ b/ext/re/re.pm @@ -434,33 +434,33 @@ or blessing of the object. =item regmust($ref) -If the argument is a compiled regular expression as returned by C -then this function returns what the optimiser consiers to be the longest -anchored fixed string and longest floating fixed string in the pattern. - -A fixed string is defined as being a string that must appear in the string -for the pattern to match. An anchored fixed string is a fixed string that -must appear at a particular offset from the beginning of the match. A -floating fixed string is defined as a fixed string that can appear at -any point in a range of positions relative to the start of the match. - - my $qr=qr/here .* there/x; - my ($anchored,$floating)=regmust($qr); +If the argument is a compiled regular expression as returned by C, +then this function returns what the optimiser consiers to be the longest +anchored fixed string and longest floating fixed string in the pattern. + +A I is defined as being a substring that must appear for the +pattern to match. An I is a fixed string that must +appear at a particular offset from the beginning of the match. A I is defined as a fixed string that can appear at any point in +a range of positions relative to the start of the match. For example, + + my $qr = qr/here .* there/x; + my ($anchored, $floating) = regmust($qr); print "anchored:'$anchored'\nfloating:'$floating'\n"; - + results in anchored:'here' floating:'there' -Because the C is before the C<.*> in the pattern its position -can be determined exactly. The C however is the opposite. -It could appear at any point after where the anchored string could appear. +Because the C is before the C<.*> in the pattern, its position +can be determined exactly. That's not true, however, for the C; +it could appear at any point after where the anchored string appeared. Perl uses both for its optimisations, prefering the longer, or, if they are equal, the floating. B This may not necessarily be the definitive longest anchored and -floating string. This will be what the optimiser of the Perl that you +floating string. This will be what the optimiser of the Perl that you are using thinks is the longest. If you believe that the result is wrong please report it via the L utility.