in reply to Regex optimization
not tested, but I think it's OK :)while # use a loop to grab all instances (m| # use pipes to delimit, so no escaping / <tr # beginning of row .*? # minimal match of anything >(\d{5}) # > followed by 5 digits (remember digits) .*? # minimal match of anything >(\d{2}) # > followed by 2 digits (remember digits) .*? # minimal match of anything >(\d{3}) # > followed by 3 digits (remember digits) .*? # minimal match of anything >(\d{3}) # > followed by 3 digits (remember digits) .*? # minimal match of anything >(\d{2}) # > followed by 2 digits (remember digits) .*? # minimal match of anything ( |\w) # or a letter </FONT> # followed by a closing font tag |isxg) { # case (i)nsensitive, treat as (s)ingle line, # e(x)tended comments, match (g)lobally (all) my @row = ($1,$2,$3,$4,$5,$6); # now do whatever with @row } # condensed while(m|<tr.*?>(\d{5}).*?>(\d{2}).*?>(\d{3}).*?>(\d{3}).*?>(\d{2}).*?( + |\w)</FONT>|isg) { my @row = ($1,$2,$3,$4,$5,$6); }
cLive ;-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Regex optimization
by deryni (Beadle) on May 08, 2001 at 11:21 UTC | |
by cLive ;-) (Prior) on May 08, 2001 at 13:11 UTC | |
by deryni (Beadle) on May 08, 2001 at 13:16 UTC |