Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Regular Expressions: Call for Examples

by stefp (Vicar)
on Jul 21, 2002 at 20:56 UTC ( #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
Node Status?
node history
Node Type: note [id://183870]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2021-02-26 15:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?