develooper Front page | perl.perl6.users | Postings from November 2019

getting comb to return match objects

Thread Next
From:
Joseph Brenner
Date:
November 10, 2019 22:46
Subject:
getting comb to return match objects
Message ID:
CAFfgvXUpbDhCaUuf1JbhnoHxs8ehdwrNNFXNqdMiTu0Mq-91mg@mail.gmail.com
Can someone give me an example of how to use the comb routine to
return a list of match objects?

The documentation here:

https://docs.perl6.org/type/Str#routine_comb

Mentions a boolean option to get match objects:

> If $matcher is a Regex, each Match object is
> converted to a Str, unless $match is set.

I gather that I must be reading this signature
wrong somehow, I can't get it to work:

> multi sub    comb(Regex:D $matcher, Str:D $input, $limit = Inf, Bool :$match)

I keep trying variations of things like this:

    my @hits = comb(m/$search_pattern/, $chunk, 100, True);

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About