develooper Front page | perl.perl5.porters | Postings from August 2000

Re: Proposal for \v and \V, the small- and large- cut regex opera tors.

From:
Johan Vromans
Date:
August 10, 2000 02:12
Subject:
Re: Proposal for \v and \V, the small- and large- cut regex opera tors.
Message ID:
20000810111228.C16132@xs4all.nl
On Thu, Aug 10, 2000 at 04:42:56AM -0400, Ilya Zakharevich wrote:
> These are just user-defined ops.  You should be able to overwrite the
> normal ops, as in:
> 
>   sub match_all {
>     use re_ops 'overload_usual_ops';
>     "(" . group(1, [ 'a' .. 'z' ] * [3,5] ) . ")"
>   }
> 
> Will this go?

I think so.
Of course, we need group names (trivial), and group temporaries.
I needed the latter to define a generic pattern to match quoted strings:
you need to store the starting quote somewhere to find the ending quote,
but I didn't want this to have impact on the pattern as a whole. E.g.,

   $qp = qr/((['"]).*?\2)/;
   @a = $str =~ /$qp/g;

and have @a contain only the quoted strings, and not (also) the individual
quotes.

> > Variable interpolation can be handled using Damian's curried expressions.
> On XRay:
> Summary for query "curried;Damian":
>    found 0 matches in 0 files.

http://tmtowtdi.perl.org/rfc/23.pod

-- Johan



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