# New Ticket Created by  Pepe Schwarz 
# Please include the string:  [perl #126713]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=126713 >


Consider the following two regexen and their matching output, or lack thereof:

11:39 < psch> m: say "abcd" ~~ /^(a | b | bc | cd)*?$/; my @a = < a b bc cd >; 
say "abcd" ~~ /^(@a)*?$/
11:39 <+camelia> rakudo-moar : OUTPUT«「abcd」␤ 0 => 「a」␤ 0 => 「b」␤ 0 => 
「cd」␤Nil␤»

S05 says: 

An interpolated array:

     / @cmds /

is matched as if it were an alternation of its literal elements. Ordinarily it 
matches using junctive semantics:

     / [ $(@cmds[0]) | $(@cmds[1]) | $(@cmds[2]) | ... ] /

Taking this literal still matches when written as the long form:

11:51 <psch> m: my @a = < a b bc cd >; say "abcd" ~~ /^( $(@a[0]) | $(@a[1]) | 
$(@a[2]) | $(@a[3]) )*?$/
11:51 <camelia> rakudo-moar : OUTPUT«「abcd」␤ 0 => 「a」␤ 0 => 「b」␤ 0 => 「cd」␤»

With the S05 quote I'd expect the array to interpolate into any of the two 
other regexen and produce the same match.

Reply via email to