Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have a module that takes a regular expression as part of a config file. It parses a web page and tries to locate a specific link based on the date. One particular page happens to use tables making this difficult. An example page might look like:
<TABLE> <TD><A HREF="/yesterday"><IMG ...></a></td> <TD>5-2-2001</td> <TD><A HREF="/today"><IMG ...></a></td> <TD>5-3-2001</td> </table>
Initially I tried to use m|A HREF="(.*?)">.*?5-3-2001|igs; This works, but not quite the way I want. The problem is, no matter the date given, it always finds the first HREF. I've read over the perlre docs and figured out why it does this, but I can't figure out how to do what I want without using special code
And that, of course, is the other complication. As I said above, I'm trying to use a system I wrote that reads the RE from a config file. I don't want to have to write code specifically for this one instance...I'd rather be able to handle it with the one RE in the config file. Any ideas, or do I just have to suck it up and write code to do this kind of thing?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Complicated(?) RE help
by Anonymous Monk on May 03, 2001 at 21:49 UTC | |
|
Re: Complicated(?) RE help
by Masem (Monsignor) on May 03, 2001 at 20:36 UTC |