Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Regular Expressions: Call for Examples

by stefp (Vicar)
on Jul 21, 2002 at 20:56 UTC ( [id://183870]=note: print w/replies, xml ) Need Help??


in reply to Regular Expressions: Call for Examples

Can I throw a problem at you that I never took the time to think out and that may add some salt to your book? In perl5, it is impossible to get at capture in an embedded regular expression:

my $qr = qr|whatever(somecapture_re)whatever|; my ($captured) = m/$qr/; # does not work

A few week ago, I looked at your draft (forgot the URL). It looks promising. My problem is: find an API to stash away that information and get it back. Probably, it will not very pretty but there no way to "modularize" regexen in perl5. I mean by that, to build interesting regexen from simpler ones.

I once looked at your draft (forgot the URL), it seemed pretty interesting.

-- stefp -- check out TeXmacs wiki

Replies are listed 'Best First'.
Re: Re: Regular Expressions: Call for Examples
by jryan (Vicar) on Jul 21, 2002 at 21:54 UTC
    my $string = "whateversomecapture_rewhatever"; my $qr = qr|whatever(somecapture_re)whatever|; my ($captured) = $string =~ m/$qr/; print $captured, " ", $1;
    prints:
    somecapture_re somecapture_re

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2025-05-22 06:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.