Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Perl6 global regex matching

by moritz (Cardinal)
on Oct 20, 2015 at 10:29 UTC ( #1145405=note: print w/replies, xml ) Need Help??


in reply to Perl6 global regex matching

There's not much use in doing a global regex match with an anchored regex.

Furthermore, a global regex match returns a list of matches, so use a for-loop to iterate over them:

use v6; my $line = '124des123'; for $line ~~ m:g/ \d ** 2..3 / -> $match { say ~$match; }

Output:

124 123

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1145405]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2020-05-27 23:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (162 votes). Check out past polls.

    Notices?