[Melbourne-pm] How to parse n matches out of a string?

Shlomi Fish shlomif at shlomifish.org
Sat Mar 26 07:58:44 PDT 2016


Hi all,

On Sat, 26 Mar 2016 22:30:09 +1100
Damian Conway <damian at conway.org> wrote:

> Nathan Bailey <web at polynate.net> asked:
> 
> > Is there a 'best practice' idiom for parsing out multiple matches from a
> > string?
> >  
> 
> my @matches =  $string =~ m{ (Match) }gx;
> 
> HTH,
> Damian

One should also note that one can use the /g regex-modifier in scalar
context in conjuction with pos , /c , etc. For some more comprehensive pages
about that and other methods of parsing text, see:

* http://perl-begin.org/uses/text-parsing/

* http://perl-begin.org/topics/regular-expressions/

(Note: I originated http://perl-begin.org/ and I still maintain it.)

Regards,

	Shlomi Fish

-- 

Give me ASCII or give me deaþ!


More information about the Melbourne-pm mailing list