On 1月3日, 下午10時00分, [EMAIL PROTECTED] (Chas. Owens) wrote:
> On Jan 3, 2008 8:27 AM, howa <[EMAIL PROTECTED]> wrote:
> snip> And it should handle other rare cases, e.g.
>
> > my $str = " <div   \n  style='...'> apple </div> ";
>
> snip
>
> And right there you showed why regexes are not good for parsing HTML
> (and XML).  That problem is non-trival and therefore we have modules
> that take care of the messy parsing that is necessary to get the
> information you want.  See my other email for the names of some
> modules that you might find handy.

Even that , I would like to know how to make this work...

For example, why the following didn't work, e.g.

use strict;

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

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

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

    print "UnMatched";
}


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


Reply via email to