Re: Variable character class

2019-09-02 Thread Paul Procacci
Was talking to folks over on the #perl6 IRC channel. It appears the recommended way is: sub matching_chars(Str $chars_to_match, Str $str) { # warnings, treats as string not variable $str ~~ /<$_>/ given "<[$chars_to_match]>"; } ~Paul On Sat, Aug 31, 2019 at 9:54 PM yary wrote: > I fou

Re: Variable character class

2019-09-02 Thread William Michels via perl6-users
Sorry Paul, I don't get the correct answer in any of the three cases I tried. Here's what 6Pad returns: https://perl6.github.io/6pad/ sub matching_chars(Str $chars_to_match, Str $str) { # warnings, treats as string not variable $str ~~ /<$_>/ given "<[$chars_to_match]>"; } say matching_c

Re: Variable character class

2019-09-02 Thread Paul Procacci
I don't know then. I've created the following ticket: https://github.com/perl6/doc/issues/2999 Feel free to place your own input there if you feel the need. On Mon, Sep 2, 2019 at 12:37 PM William Michels wrote: > Sorry Paul, I don't get the correct answer in any of the three cases I > tried.

Re: Variable character class

2019-09-02 Thread Gianni Ceccarelli
On 2019-09-02 The Sidhekin wrote: > To have the (1-character) strings used a literals, rather than > compiled as subrules, put them in an array instead of a block wrapped > in angle brackets: > > sub contains( Str $chars, Str $_ ) { > my @arr = $chars.comb; > m:g/@arr+/ This looks to be th

Re: Variable character class

2019-09-02 Thread Joseph Brenner
> The "implicit" alternation comes from interpolating a list (of subrules, > see below). I see. And that's discussed here (had to really look for it): https://docs.perl6.org/language/regexes#Quoted_lists_are_LTM_matches At first I was looking further down in the "Regex interpolation" section,

List in regexp

2019-09-02 Thread yary
> > I see. And that's discussed here (had to really look for it): > https://docs.perl6.org/language/regexes#Quoted_lists_are_LTM_matches > At first I was looking further down in the "Regex interpolation" > section, where it's also touched on, though I kept missing it: > > When an array variable is