|Keep It Simple, Stupid|
Returning regexp pattern that was used to matchby crabbdean (Pilgrim)
|on May 03, 2004 at 14:18 UTC||Need Help??|
crabbdean has asked for the
wisdom of the Perl Monks concerning the following question:
Personally I get sick of all the regexp questions on here but this is one I don't ever seeing before or heard of being done.
I call a regexp with a hash:
... which is compiles into a search string in the object using the method ...
.... now when I do a pattern match against it (which by the way works perfectly!) ... I then have a problem ... I know $& returns the matched string ... but I need what PATTERN WAS USED to match against the string. How?
This is the code where I do the matching and want to return the PATTERN USED.
Reasons is I then need to process the original hash (shown at the top of this) using the PATTERN USED as the key to the hash for what entry was found. How can I do this?
The Funkster of Mirth
Programming these days takes more than a lone avenger with a compiler. - sam
RFC1149: A Standard for the Transmission of IP Datagrams on Avian Carriers