in reply to Benchmarking "Are all these characters in this sentence?"
Putting the whole sentence into a character class will kind of suck with veeery long sentences but medium-sized cases should benefit from the one-pass approach.martin => sub { # args: sentence, wantedchars '' eq $_[1] || '' ne $_[0] && $_[1] =~ /^[\Q$_[0]\E]*\z/; },
Update: fixed the order of subroutine parameters
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Benchmarking "Are all these characters in this sentence?"
by RMGir (Prior) on Sep 05, 2008 at 17:22 UTC | |
by martin (Friar) on Sep 08, 2008 at 09:43 UTC |