Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Here's the expression I'm currently using to parse out the currencies:<TR BGCOLOR="#F0F0DF"> <TD ALIGN=LEFT VALIGN=TOP CLASS="mrktdata1"><FONT FACE="arial, +helvetica" SIZE="-1" COLOR="#000000">Falkland Island Pound (*FKP)</FO +NT></TD> <TD ALIGN=RIGHT VALIGN=TOP CLASS="mrktdata1"><FONT FACE="arial +,helvetica" SIZE="-1" COLOR="#000000">1.4409 </FONT></TD> </TR></TR>
Some sample output:while ($content =~ /(\**\s?\w+\.?\s+\S*\.?\s*\w*\.?\/?\s*\w*\.?\/?\s*\ +w*\.?\/?\s*\(\*?[A-Z]{2,4}\))/g){ print RAW "$1\n";
It works, but as you can see my expression is rather cumbersome. Any ideas on how I can somehow group things and/or condense or simplify it? I've tried using variations of \S to catch instances of odd things like '&' or '/', but that really slows it down. Is there someway I can group all the repeating sections? I've attempted a couple grouping schemes and tried putting it into a class, but without much success. I'm also trying to keep it somewhat generic and flexible to catch name changes, etc.Falkland Island Pound (*FKP) South African Rand/fin (ZAR)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: simplifying an expression
by Sifmole (Chaplain) on Apr 20, 2001 at 16:17 UTC | |
by Sifmole (Chaplain) on Apr 20, 2001 at 16:39 UTC | |
|
Re: simplifying an expression
by suaveant (Parson) on Apr 20, 2001 at 17:50 UTC |