|Don't ask to ask, just ask|
Strange regex behavior - beware chunk boundaries!by tame1 (Pilgrim)
|on Aug 14, 2005 at 21:02 UTC||Need Help??|
tame1 has asked for the
wisdom of the Perl Monks concerning the following question:
UPDATE: Seems that the data I was testing for landed right on a buffer chunk boundary. Not good. Let that be a lesson to all us part timers - boundaries suck!
Recently, I had to drag my old perl knowledge up from the bottom of my brain to do a little db creation work.
I am taking a web page from our local chamber of commerce, where they give an alphabetical listing of their members, and sucking it in with Net::HTTP. I then cycle through the $buffer looking for occurances of "ID=XXXX". Those are links to "more info" on each company. Using the built-up array of IDs, I then pull each companies individual data.
Anyhow, to make a long story short (too late, right?) one business, serial number 3975, is always skipped!!! the regex $buf =~ /ID=([0-9]+)/ seems to think 3975 doesn't match! The only answer I have found is to first write the main web page to a file, then read in the file. THEN it matches.
Here is the code I am/was using:
From the code above you can see the actual site and page I am trying to steal from. If anyone can enlighten me as to what is wrong (what I have done wrong) I would greatly appreciate it, as this has taken 3 hours of my time and made me feel very stupid. I am using perl 5.8.6.
What does this little button do . .<Click>; "USER HAS SIGNED OFF FOR THE DAY"