Hi Gianni, I'm not sure of the Perl5 case, but what you're saying is,
if your target string is backslashed, be sure to "quote-interpolate
it" in Perl6? (see below):

say matching_chars( '+/][',  'Apple ][+//e' ); # says (「][+//」)
say matching_chars( '+\/\]\[', 'Apple ][+//e' ); # says (「][+//」)
say matching_chars( '+/][', 'Apple \]\[+\/\/e' ); # (「]」 「[+」 「/」 「/」)
say matching_chars( '+\/\]\[', 'Apple \]\[+\/\/e' ); # (「\]\[+\/\/」)

#say matching_chars( '+/][', q'Apple \]\[+\/\/e' ); # says error
say matching_chars( '+/][', q/  Apple \]\[+\/\/e  / ); # says (「]」 「[+//」)
#say matching_chars( '+/][', q:b'Apple \]\[+\/\/e' ); # says error
say matching_chars( '+/][', q:b/ Apple \]\[+\/\/e / ); # says (「][+//」)
say matching_chars( '+/][', "Apple \]\[+\/\/e" ); # says (「][+//」)

HTH, Bill.




On Tue, Sep 3, 2019 at 9:51 AM Gianni Ceccarelli <dak...@thenautilus.net> wrote:
>
> On Tue, 3 Sep 2019 09:15:54 -0700
> William Michels via perl6-users <perl6-us...@perl.org> wrote:
>
> > Just a short note that Eirik's array-based code seems to work fine,
> > with-or-without backslash-escaping the first input string (minimal
> > testing, below):
>
> Oh, sure. But when the target string contains backslashes, it will
> behave differently from the P5 version, in that the P5 version won't
> report the backslashes as matching (because of the way it builds its
> regex).
>
>
> --
>         Dakkar - <Mobilis in mobile>
>         GPG public key fingerprint = A071 E618 DD2C 5901 9574
>                                      6FE2 40EA 9883 7519 3F88
>                             key id = 0x75193F88

Reply via email to