in reply to Re: Re: test if a string contains a list member
in thread test if a string contains a list member
A more sophisticated approach might be to keep a hash of banned words with associated hand written regexes to match them. On the fly you could either match against each in turn, maximizing the optimizations available to the regex engine. Or more simply cat them all together as you are doing here, but at least you would have the certainty of knowing the regex fragment used would be correct (as you can make it)
Again I relise this might be too much for this particular situation, but its worth considering, you'd be suprised where bugs from this type of approach show up. The other day I was playing with HTML::TableExtract that uses a very similar mechanism to scan for table column headers. It failed very oddly when a parenthesis or | was in the header name. Oddly enough that it took me a while to track down... ;-)
Yves
--
You are not ready to use symrefs unless you already know why they are bad. -- tadmc (CLPM)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re (tilly) 4: test if a string contains a list member
by tilly (Archbishop) on Oct 21, 2001 at 19:32 UTC | |
by demerphq (Chancellor) on Oct 21, 2001 at 20:55 UTC | |
|
Re(4): test if a string contains a list member
by mojotoad (Monsignor) on Nov 07, 2002 at 16:52 UTC |