in reply to Altering regular expression trees
There are two general purpose solutions to this. japhy's YAPE::Regex will parse the string representation of your regular expression and return an element tree. You could see about manipulating that or getting your info from that somehow. The thing is though - its parsing regexes which means it isn't pulling directly from perl's actual parsed regex. For that you need MJD's Rx module. The issue with is that when I last looked, it required a patch to the perl interpreter (also supplied). If you need a high fidelity copy of your regex and altering your interpreter is not impossible then this is likely the best route.
Alternatively... you could attempt to capture the output from 'use re "debug"'. I asked about this once at Trapping re 'debug' and all I can come up with is if you throw a single instance of perl interpreter at a regex somewhat like `perl -Mre=debug -e 'qr/.../' 1> /dev/null 2> re.debug.output.txt` and then capture the output from STDERR from that. I've never been able to capture this data from within a perl process - not through redirecting STDERR, tying it or anything.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Altering regular expression trees
by ryan (Pilgrim) on Jul 30, 2003 at 03:20 UTC | |
by diotalevi (Canon) on Jul 30, 2003 at 07:46 UTC |