Re: RFC 110 (v3) counting matches
[email protected] (Mark-Jason Dominus)
| Newsgroups | perl.perl6.language.regex |
|---|---|
| Message-ID | <[email protected]> |
> Drawing on some of the proposals for extended 'for' syntax:
> for my($mo, $dy, $yr) ($string =~ /(\d\d)-(\d\d)-(\d\d)/g) {
> ...
> }
>
> This still requires that you know how many () matching groups are in
> the RE, of course. I don't think I would consider that onerous.
If ther regex is fixed at compile time, you can simple count. But if
the regex varies at run time, it's not only onerous, it's pretty near
to impossible.