in reply to Re^5: Nonrepeating characters in an RE (performance)
in thread Nonrepeating characters in an RE

> I'd expect it to win a lot

This will largely depend on the dictionary and the test samples.

With post filtering a pattern like "adieu" would produce many false positives to be filtered, but the result set would be huge anyway.°

But a pattern like "Mississippi" would produce no false positives.

But avoiding some false positives with lookaheads might turn out to be more expensive than filtering them a posteriori.

Assuming the OP is only looking for some matches instead of all matches, I'm confident my approach does better.

Or at least good enough to be justified by simpler code.

FWIW: prefer the non-embedded version.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

Update

°) all 5 letter words in the dictionary ( not 26**5 ) minus those with at least one repetition. Probably one thousand in English?

  • Comment on Re^6: Nonrepeating characters in an RE (performance)