summaryrefslogtreecommitdiff
path: root/pod/perlre.pod
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2018-02-19 20:40:20 -0700
committerKarl Williamson <khw@cpan.org>2018-02-19 20:48:45 -0700
commit3337229ca19b517df4e7e43fd4312f0ee9e5b6c0 (patch)
treef05bea57e3b1796702dd25b8c8ce2429e352546d /pod/perlre.pod
parent8638266fb1a6a7f9b6ce2567347bfba94f8b2414 (diff)
downloadperl-3337229ca19b517df4e7e43fd4312f0ee9e5b6c0.tar.gz
Add atomic script runs
This is an extension to the new script_run feature that is syntactic sugar for the idiom espected to be most commonly used: (*sr:(?>...)) can be written as (*asr:...)
Diffstat (limited to 'pod/perlre.pod')
-rw-r--r--pod/perlre.pod9
1 files changed, 8 insertions, 1 deletions
diff --git a/pod/perlre.pod b/pod/perlre.pod
index b5d5517167..29082a66d0 100644
--- a/pod/perlre.pod
+++ b/pod/perlre.pod
@@ -2469,6 +2469,7 @@ following match, see L</C<< (?>pattern) >>>.
=head2 Script Runs
X<(*script_run:...)> X<(sr:...)>
+X<(*atomic_script_run:...)> X<(asr:...)>
A script run is basically a sequence of characters, all from the same
Unicode script (see L<perlunicode/Scripts>), such as Latin or Greek. In
@@ -2499,10 +2500,16 @@ backtracking occurs until something all in the same script is found that
matches, or all possibilities are exhausted. This can cause a lot of
backtracking, but generally, only malicious input will result in this,
though the slow down could cause a denial of service attack. If your
-needs permit, it is best to make the pattern atomic.
+needs permit, it is best to make the pattern atomic. This is so likely
+to be what you want, that instead of writing this:
(*script_run:(?>pattern))
+you can write either of these:
+
+ (*atomic_script_run:pattern)
+ (*asr:pattern)
+
(See L</C<(?E<gt>pattern)>>.)
In Taiwan, Japan, and Korea, it is common for text to have a mixture of