summaryrefslogtreecommitdiff
path: root/pod/perlre.pod
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2019-03-16 14:26:49 -0600
committerKarl Williamson <khw@cpan.org>2019-03-18 10:33:30 -0600
commitfa690ddc3f79a739cf56276deac7c278f430f077 (patch)
treeb13b9f1077eaa87a7535bc15c0dfc96a397bd3e0 /pod/perlre.pod
parent8dbb2d9565f118c5bb1b0fdd1438830bb0f0022b (diff)
downloadperl-fa690ddc3f79a739cf56276deac7c278f430f077.tar.gz
perlre: Link technique for variable length lookbehind
This web page gives a technique that one can use to achieve variable length lookbehinds.
Diffstat (limited to 'pod/perlre.pod')
-rw-r--r--pod/perlre.pod12
1 files changed, 8 insertions, 4 deletions
diff --git a/pod/perlre.pod b/pod/perlre.pod
index 338caaab0d..af66136d49 100644
--- a/pod/perlre.pod
+++ b/pod/perlre.pod
@@ -1635,11 +1635,13 @@ multi-character match under C</i>, as that could match a single
character, or it could match two or three, and that makes it variable
length, which is forbidden.
-There is a special form of this construct, called C<\K> (available since
-Perl 5.10.0), which causes the
+However, 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
-lookbehind. The use of C<\K> inside of another lookaround 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
@@ -1672,7 +1674,9 @@ only for fixed-width lookbehind of up to 255 characters. Note that a
compilation error will be generated if the assertion contains a
multi-character match under C</i>, as that could match a single
character, or it could match two or three, and that makes it variable
-length, which is forbidden.
+length, which is forbidden. However, there is a technique that can be
+used to handle variable length lookbehinds. It is described in
+L<http://www.drregex.com/2019/02/variable-length-lookbehinds-actually.html>.
The alphabetic forms are experimental; using them yields a warning in the
C<experimental::alpha_assertions> category.