go ahead... be a heretic | |
PerlMonks |
Re: Words, no consecutive doubled letters but repeated letters (updated x2)by AnomalousMonk (Archbishop) |
on Oct 27, 2022 at 20:41 UTC ( [id://11147757]=note: print w/replies, xml ) | Need Help?? |
/\A (?= [[:alpha:]]{12} \Z) (?! .* (.) \g-1) (?= .* (.) .+ \g-1)/x and print
But if you're scanning a dictionary, don't you know to begin with that all the words are words? It might be faster to scan with Update 1: Note that the regexes above need Perl version 5.10+ to support the \g{n} backreference operator. Update 2: I second GrandFather's point about splitting up the components of a complex filter regex into individual regexes: they become simpler and easier to understand and manage, In that vein: (All the stuff with $::n is for development/debug only; it can be discarded for end use.) Give a man a fish: <%-{-{-{-<
In Section
Seekers of Perl Wisdom
|
|