File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -588,6 +588,24 @@ without L<MONKEY-SEE-NO-EVAL|
588
588
In theory, careless use of C « <{}> » will only result in an exception being
589
589
thrown, and should not introduce security issues.
590
590
591
+ = head2 C < | > vs C < || > : which branch will win
592
+
593
+ To match one of several possible alternatives, C < || > or C < | > will be used. But
594
+ they are so different.
595
+
596
+ While there are more alternations than one matched, for those separated by
597
+ C < || > , the first matching alternation wins; for those separated by C < | > ,
598
+ which to win is decided by LTM strategy. See also:
599
+ L < documentation on C < || > |/language/regexes#Alternation:_|| > and
600
+ L < documentation on C < | > |/language/regexes#Longest_Alternation:_| > .
601
+
602
+ For advice of which to use: for simple regexes just using C < || > instead of C < | >
603
+ will get you familiar semantics, but if writing grammars then it's useful to
604
+ learn about LTM and declarative prefixes and prefer C < | > . And keep yourself
605
+ away from using them in one regex. When you have to do that, add parentheses
606
+ and ensure that you know how LTM strategy works to make the code
607
+ do what you want.
608
+
591
609
= head1 Common Precedence Mistakes
592
610
593
611
= head2 Adverbs and Precedence
You can’t perform that action at this time.
0 commit comments