in reply to Re^2: Matching Many Strings against a Large List of Hash Keys (case insensitively, longest key first)
in thread Matching Many Strings against a Large List of Hash Keys (case insensitively, longest key first)
I don't disagree with your commentary about the crappy regex. It isn't mine though, it is what the OP had.
And, while it's true that my solution has some serious shortcomings, your solution has its own set of problems. The OP said that he needs the $key value later to get values out of the hash. If it is a precompiled regex, he can't use it. You'll probably need to compile a hash of key, regex pairs, but that will raise issues of ordering again. Also, $s contains the lc string, I think you meant $_ in the print line. That's just a typo though.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Matching Many Strings against a Large List of Hash Keys (case insensitively, longest key first)
by ikegami (Patriarch) on May 14, 2010 at 22:53 UTC |