Don't ask to ask, just ask | |
PerlMonks |
Using a Regex to extract tagged contentby Anonymous Monk |
on Feb 27, 2004 at 16:09 UTC ( [id://332285]=perlquestion: print w/replies, xml ) | Need Help?? |
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I've been looking around through some regex docs and I can't find out how to do this: I have strings like "<msg dest="*">hey</msg>". And I want to get the 'msg' from the starting tag, and everything between "<msg dest="*">" and "</msg>". What I've come up with is as follows:
if that makes sense. the regex needs to use what was found in the ([A-Za-z]+) to find a matching end tag for it. I read about how to do this in the perldocs that come with windows, but im on linux now and can't find it... Also, I know i could use some sort of XML module for this, but I'd rather do it with regex. thanks Regards, Jasper
Back to
Seekers of Perl Wisdom
|
|