So when I go to write another HTML-scraper like this, I often start by copying a block of the HTML that I want to capture repetitions of up and down the template-generated page, and I paste it into the STDIN of this little utility. I hit return and control-D, and then out comes a big dumb regexp that loosely matches that piece of input. I take out the bits of text that I know will vary, and I replace them with (.*?) or the like, and voilà, screenscraper.
That's really cool (Score:2)
-sam
Re: (Score:1)
Is there a difference from
$_ = quotemeta $_;?Re: (Score:2)
Re: (Score:1)
quotemetais in fact problematic for this purpose because backslashes are not treated the same in regex quoting context vs double-quote quoting context. Which annoyed me when I was trying to interpolate user data in a thes///pattern in a string to beevaled.