Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^3: How to grab a portion of file with regex

by kielstirling (Scribe)
on Mar 15, 2013 at 02:46 UTC ( #1023603=note: print w/replies, xml ) Need Help??


in reply to Re^2: How to grab a portion of file with regex
in thread How to grab a portion of file with regex

Well instead of trolling why not supply a working example to help ??

Its always the Anonymous Monk lacking courage to put a name to a comment
  • Comment on Re^3: How to grab a portion of file with regex

Replies are listed 'Best First'.
Re^4: How to grab a portion of file with regex
by Anonymous Monk on Mar 15, 2013 at 04:00 UTC

    Well instead of trolling why not supply a working example to help ?? Its always the Anonymous Monk lacking courage to put a name to a comment

    How is it trolling to point out the shortcomings of a "solution"? Maybe you should look up the definition of troll

    What courage is required to point out a simple fact about HTML::Parser? Are you under the impression that HTML::Parser is a high level parser?

    Your "solution" doesn't fetch the portion of page from class = lastUnit to class = line margin10 -- its incomplete -- it is lots easier/shorter/simpler to use  m{\Q$start\E(.+?)\Q$end\E}i instead of that HTML::Parser low-levelness

    Have you seen Re: How to grab a portion of file with regex (don't)? Its not unlike a minimum of three different tutorials/walkthroughs/step-by-step-instructions on extracting/xpathing the dom , some even compare/contrast with HTML::Parser


      You make some valid points. The example in the question didn't seem to need the content of the div.
      I do agree that working with the DOM is a much better way to parse HTML.

        You make some valid points. The example in the question didn't seem to need to content of the div. I do agree that working with the DOM is a much better way to parse HTML. <

        :)

        #!/usr/bin/perl -- use strict; use warnings; use XML::LibXML; my $dom = XML::LibXML->new( qw/ recover 2 / )->load_html( location => q{junk.html} ); for ( $dom->findnodes(q{ //div[ contains( @class, 'lastUnit' ) ] }) ){ print "\n", $_->nodePath, "\n\n$_\n"; } __END__

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1023603]
help
Chatterbox?
[ambrus]: thezip: is Activestate Perl usable for your scenario instead?
[MidLifeXis]: Yeah, --notest is good, not sure I would do --force.
[thezip]: It fails 2/10 tests in that group. What are the ramifications if I force it? What should I look for for?
[thezip]: I've migrated from ActiveState to Strawberry. No going back...
[thezip]: I'll try the --notest arg first when I get back from meetings (after lunch).
[thezip]: Thanks guys for your comments! :-)
[1nickt]: Quick survey: has anyone used or even heard of autobox?
[Corion]: thezip: I would expect some (fancier?) numeric formatting to fail from these test failures
[1nickt]: ( Sometimes when idle I browse remote corners of the code repo at $work ... usually this yields knowledge of projects to decline and coworkers to avoid ... )
[LanX]: sure

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (16)
As of 2017-03-23 17:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (290 votes). Check out past polls.