On 1月3日, 下午7時19分, [EMAIL PROTECTED] (Howa) wrote:
> e.g.
>
> <div>apple </div> <div> orange </div>
> <div stlye='...'>apple </div> <div> orange </div>
>
> I want to extract "div" from the input
>
> thanks.

This is my current codes:

#--------------------------------------------------------
use strict;

my $str = " <div style='...'> apple </div> ";

if ($str =~ /<(.*?)>/gi) {

    print "Matched: " . $1;
} else {

    print "UnMatched";
}

#--------------------------------------------------------

I want:

Matched: div

Rather then:

 style='...'

And it should handle other rare cases, e.g.

my $str = " <div   \n  style='...'> apple </div> ";



Thank very much


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


Reply via email to