in reply to Example of brainfog (Was: inconsistent regex matching)

Parsing HTML by hand is always fragile, and in my experience never ends well. Have you considered a module like HTML::TreeBuilder and then use its look_down method to select just the elements you're interested in?

  • Comment on Re: Example of inconsistent regex matching

Replies are listed 'Best First'.
Re^2: Example of inconsistent regex matching
by ww (Archbishop) on Nov 22, 2015 at 00:08 UTC

    Having expressed that wisdom myself, I blush to admit I expected to write a quick and dirty one-off for a job that -- while tedious -- I could have done in far less time manually, and, undoubtedly, were I familiar with the HTML::TreeBuilder or some of it's cousins, with one of those.

    But the truly horrid html (tables nested in tables; etc.) also disinclined me to attack it with a tool that pretty much expects (and I understand it; pls correct me if this is wrong) more-or-less standards-compliant source.

    In short, + + ; thank you ... but at this point, I'm far more interested in the apparently regex anomaly than in re-writing code that might get used as often as annually.


    ++$anecdote ne $data

      What's wrong with nested tables?
      The way forward always starts with a minimal test.