Hi
I have the following HTML structure:

<sm:a>
        <sm:b>
                BBB
        </sm:b>
        <sm:c>
                CCC
        </sm:c>
</sm:a>

Every line in this structure is an element of an array,
named @lines, and I access the elements using a foreach loop.

When I know the tag's name, by example 'sm:a',
and I need to extract the information contained by '<sm:a>'
and '</sm:a>' pair and the tags too, how should I proceed ?

I tried a regexp like this:

foreach $s (@lines) {
   print "$s";
   if($s =~ m|^(<sm:a>\\n)(.*?)(\\n<\/sm:a>)$|s){
      ($l,$c,$r) = ($1,$2,$3);
      print "OK\n";
      print "l: '$l'\n";
      print "c: '$c'\n";
      print "r: '$r'\n";
   }else{
      print "HEHE\n";
   }
}

Help me. Thank you.


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to