in reply to Using a Regex to extract tagged content

Greetings all,
just a quick (and minimally tested) thought
my @matches = map{ m|<(\w+)^>*>(^<*)</\1>|g; {'tag' => $1, 'txt' => $2}} $data;
this will return give you and array of hashes (@matches) each hash containing keys 'tag' (the tag name) and 'txt' (the text between the tags).
HTH

UPDATE: obviously map still eludes me! disregard the response above.
-Joel
  • Comment on Re: Using a Regex to extract tagged content