This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
standardize on "lookahead" and "lookaround"
authorEd Avis <eda@waniasset.com>
Mon, 7 Dec 2015 16:08:39 +0000 (11:08 -0500)
committerRicardo Signes <rjbs@cpan.org>
Mon, 7 Dec 2015 16:18:45 +0000 (11:18 -0500)
...not the hyphenated form

commit message by rjbs

lib/unicore/mktables
pod/perlre.pod
pod/perlreref.pod
pod/perlunicode.pod
regcharclass.h
regcomp.c
regexec.c

index 4fd5541..57e05f3 100644 (file)
@@ -3100,7 +3100,7 @@ END
 
 #   Not currently used, not fully tested.
 #    sub peek {
-#        # Non-destructive look-ahead one non-adjusted, non-comment, non-blank
+#        # Non-destructive lookahead one non-adjusted, non-comment, non-blank
 #        # record.  Not callable from an each_line_handler(), nor does it call
 #        # an each_line_handler() on the line.
 #
index e45e444..08c98eb 100644 (file)
@@ -1242,48 +1242,48 @@ Not doing so may lead to surprises:
 The problem here is that both the group named C<< a >> and the group
 named C<< b >> are aliases for the group belonging to C<< $1 >>.
 
-=item Look-Around Assertions
+=item Lookaround Assertions
 X<look-around assertion> X<lookaround assertion> X<look-around> X<lookaround>
 
-Look-around assertions are zero-width patterns which match a specific
+Lookaround assertions are zero-width patterns which match a specific
 pattern without including it in C<$&>. Positive assertions match when
 their subpattern matches, negative assertions match when their subpattern
-fails. Look-behind matches text up to the current match position,
-look-ahead matches text following the current match position.
+fails. Lookbehind matches text up to the current match position,
+lookahead matches text following the current match position.
 
 =over 4
 
 =item C<(?=pattern)>
 X<(?=)> X<look-ahead, positive> X<lookahead, positive>
 
-A zero-width positive look-ahead assertion.  For example, C</\w+(?=\t)/>
+A zero-width positive lookahead assertion.  For example, C</\w+(?=\t)/>
 matches a word followed by a tab, without including the tab in C<$&>.
 
 =item C<(?!pattern)>
 X<(?!)> X<look-ahead, negative> X<lookahead, negative>
 
-A zero-width negative look-ahead assertion.  For example C</foo(?!bar)/>
+A zero-width negative lookahead assertion.  For example C</foo(?!bar)/>
 matches any occurrence of "foo" that isn't followed by "bar".  Note
-however that look-ahead and look-behind are NOT the same thing.  You cannot
-use this for look-behind.
+however that lookahead and lookbehind are NOT the same thing.  You cannot
+use this for lookbehind.
 
 If you are looking for a "bar" that isn't preceded by a "foo", C</(?!foo)bar/>
 will not do what you want.  That's because the C<(?!foo)> is just saying that
 the next thing cannot be "foo"--and it's not, it's a "bar", so "foobar" will
-match.  Use look-behind instead (see below).
+match.  Use lookbehind instead (see below).
 
 =item C<(?<=pattern)> C<\K>
 X<(?<=)> X<look-behind, positive> X<lookbehind, positive> X<\K>
 
-A zero-width positive look-behind assertion.  For example, C</(?<=\t)\w+/>
+A zero-width positive lookbehind assertion.  For example, C</(?<=\t)\w+/>
 matches a word that follows a tab, without including the tab in C<$&>.
-Works only for fixed-width look-behind.
+Works only for fixed-width lookbehind.
 
 There is a special form of this construct, called C<\K> (available since
 Perl 5.10.0), which causes the
 regex engine to "keep" everything it had matched prior to the C<\K> and
 not include it in C<$&>. This effectively provides variable-length
-look-behind. The use of C<\K> inside of another look-around assertion
+lookbehind. The use of C<\K> inside of another lookaround assertion
 is allowed, but the behaviour is currently not well defined.
 
 For various reasons C<\K> may be significantly more efficient than the
@@ -1300,9 +1300,9 @@ can be rewritten as the much more efficient
 =item C<(?<!pattern)>
 X<(?<!)> X<look-behind, negative> X<lookbehind, negative>
 
-A zero-width negative look-behind assertion.  For example C</(?<!bar)foo/>
+A zero-width negative lookbehind assertion.  For example C</(?<!bar)foo/>
 matches any occurrence of "foo" that does not follow "bar".  Works
-only for fixed-width look-behind.
+only for fixed-width lookbehind.
 
 =back
 
@@ -1653,7 +1653,7 @@ C<(condition)> should be one of:
 (which is valid if the corresponding pair of parentheses
 matched);
 
-=item a look-ahead/look-behind/evaluate zero-width assertion;
+=item a lookahead/lookbehind/evaluate zero-width assertion;
 
 =item a name in angle brackets or single quotes
 
@@ -1839,7 +1839,7 @@ the C<use warnings> pragma or B<-w> switch saying it
 C<"matches null string many times in regex">.
 
 On simple groups, such as the pattern C<< (?> [^()]+ ) >>, a comparable
-effect may be achieved by negative look-ahead, as in C<[^()]+ (?! [^()] )>.
+effect may be achieved by negative lookahead, as in C<[^()]+ (?! [^()] )>.
 This was only 4 times slower on a string with 1000000 C<a>s.
 
 The "grab all you can, and do not give anything back" semantic is desirable
@@ -2242,7 +2242,7 @@ definition might succeed against a particular string.  And if there are
 multiple ways it might succeed, you need to understand backtracking to
 know which variety of success you will achieve.
 
-When using look-ahead assertions and negations, this can all get even
+When using lookahead assertions and negations, this can all get even
 trickier.  Imagine you'd like to find a sequence of non-digits not
 followed by "123".  You might try to write that as
 
@@ -2292,7 +2292,7 @@ time.  Now there's indeed something following "AB" that is not
 
 We can deal with this by using both an assertion and a negation.
 We'll say that the first part in C<$1> must be followed both by a digit
-and by something that's not "123".  Remember that the look-aheads
+and by something that's not "123".  Remember that the lookaheads
 are zero-width expressions--they only look, but don't consume any
 of the string in their match.  So rewriting this way produces what
 you'd expect; that is, case 5 will fail, but case 6 succeeds:
@@ -2329,10 +2329,10 @@ match takes a long time to finish.
 A powerful tool for optimizing such beasts is what is known as an
 "independent group",
 which does not backtrack (see L</C<< (?>pattern) >>>).  Note also that
-zero-length look-ahead/look-behind assertions will not backtrack to make
+zero-length lookahead/lookbehind assertions will not backtrack to make
 the tail match, since they are in "logical" context: only
 whether they match is considered relevant.  For an example
-where side-effects of look-ahead I<might> have influenced the
+where side-effects of lookahead I<might> have influenced the
 following match, see L</C<< (?>pattern) >>>.
 
 =head2 Version 8 Regular Expressions
index e9b784e..db7c173 100644 (file)
@@ -252,10 +252,10 @@ There is no quantifier C<{,n}>. That's interpreted as a literal string.
    (?P>name)         Recurse into a named subpattern (python syntax)
    (?(cond)yes|no)
    (?(cond)yes)      Conditional expression, where "cond" can be:
-                     (?=pat)   look-ahead
-                     (?!pat)   negative look-ahead
-                     (?<=pat)  look-behind
-                     (?<!pat)  negative look-behind
+                     (?=pat)   lookahead
+                     (?!pat)   negative lookahead
+                     (?<=pat)  lookbehind
+                     (?<!pat)  negative lookbehind
                      (N)       subpattern N has matched something
                      (<name>)  named subpattern has matched something
                      ('name')  named subpattern has matched something
index a652d8d..eb23d55 100644 (file)
@@ -1110,7 +1110,7 @@ feature, you can use one of the following:
 
 =item *
 
-Regular expression look-ahead
+Regular expression lookahead
 
 You can mimic class subtraction using lookahead.
 For example, what UTS#18 might write as
@@ -1223,7 +1223,7 @@ Level 3 - Tailored Support
 
  [17] see UAX#10 "Unicode Collation Algorithms"
  [18] have Unicode::Collate but not integrated to regexes
- [19] have (?<=x) and (?=x), but look-aheads or look-behinds
+ [19] have (?<=x) and (?=x), but lookaheads or lookbehinds
       should see outside of the target substring
  [20] need insensitive matching for linguistic features other
       than case; for example, hiragana to katakana, wide and
index 54a5011..66064d1 100644 (file)
  * 1a0687fb9c6c4567e853913549df0944fe40821279a3e9cdaa6ab8679bc286fd lib/unicore/extracted/DLineBreak.txt
  * 40bcfed3ca727c19e1331f6c33806231d5f7eeeabd2e6a9e06a3740c85d0c250 lib/unicore/extracted/DNumType.txt
  * a18d502bad39d527ac5586d7bc93e29f565859e3bcc24ada627eff606d6f5fed lib/unicore/extracted/DNumValues.txt
- * 602994a2249dfd84ae106940eb48450e3e6f1a69d489274f2618861a86f5d8e0 lib/unicore/mktables
+ * 4d44b51567e796f3021824c071a3d73fea1a664b59a064956be17850d976631e lib/unicore/mktables
  * 462c9aaa608fb2014cd9649af1c5c009485c60b9c8b15b89401fdc10cf6161c6 lib/unicore/version
  * 996abda3c0fbc2bfd575092af09e3b9b0331e624eb2e969a268457f8fd31ecbb regen/charset_translations.pl
  * d9c04ac46bdd81bb3e26519f2b8eb6242cb12337205add3f7cf092b0c58dccc4 regen/regcharclass.pl
index 059745d..cb5a5e3 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -9979,7 +9979,7 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp,U32 depth)
 
            RExC_parse++;
            paren = *RExC_parse++;
-           ret = NULL;                 /* For look-ahead/behind. */
+           ret = NULL;                 /* For lookahead/behind. */
            switch (paren) {
 
            case 'P':   /* (?P...) variants for those used to PCRE/Python */
index dbc0156..16b9e0a 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -654,7 +654,7 @@ Perl_re_intuit_start(pTHX_
                 "Intuit: trying to determine minimum start position...\n"));
 
     /* for now, assume that all substr offsets are positive. If at some point
-     * in the future someone wants to do clever things with look-behind and
+     * in the future someone wants to do clever things with lookbehind and
      * -ve offsets, they'll need to fix up any code in this function
      * which uses these offsets. See the thread beginning
      * <20140113145929.GF27210@iabyn.com>
@@ -2683,7 +2683,7 @@ S_reg_set_capture_string(pTHX_ REGEXP * const rx,
                 U32 n = 0;
                 max = -1;
                 /* calculate the right-most part of the string covered
-                 * by a capture. Due to look-ahead, this may be to
+                 * by a capture. Due to lookahead, this may be to
                  * the right of $&, so we have to scan all captures */
                 while (n <= prog->lastparen) {
                     if (prog->offs[n].end > max)
@@ -2704,7 +2704,7 @@ S_reg_set_capture_string(pTHX_ REGEXP * const rx,
                 U32 n = 0;
                 min = max;
                 /* calculate the left-most part of the string covered
-                 * by a capture. Due to look-behind, this may be to
+                 * by a capture. Due to lookbehind, this may be to
                  * the left of $&, so we have to scan all captures */
                 while (min && n <= prog->lastparen) {
                     if (   prog->offs[n].start != -1