#4p1s0: # Already optimal matching forward (?: a (?: ble | n(?:ce|t) | te | l ) | e (?: ment | n(?:ce|t) | r ) | i (?: ble | sm | ti | ve | ze | c ) | ment | ous? ) #4p0s1r: # No performance gains matching in reverse (?: (?: elb | (?:ec|t)n | et | l ) a | (?: tnem | (?:ec|t)n | r ) e | (?: elb | ms | it | ev | ez | c ) i | tnem | s?uo ) #4p1s0r: # Likewise this is not an optimal match, although: (?: ci | e (?: cn[ae] | lb[ai] | ta | vi | zi ) | iti | la | msi | re | suo | tn (?: eme? | [ae] ) | uo ) #4p0s1: # It's better than this: (?:ic|(?:[ae]nc|[ai]bl|at|iv|iz)e|iti|al|ism|er|ous|(?:e?me|[ae])nt|ou) #### #3p0s1: # Less optimal (?: (?: icat | ativ | aliz ) e | iciti | (?: ica | fu ) l | ness ) #3p1s0r: # More optimal - performance gains in reverse (?: e (?: taci | vita | zila ) | itici | l (?: aci | uf ) | ssen ) #### (?:abcd|efg|won|I|[now]|know|my|regexes) (?:abcdcba|efgfe|wonow|[now]|I|knowonk|mym|regexesexeger) (?x-ism: dcba|gfe | now |I| [own] |wonk|y m|sexeger) #### #!/usr/bin/perl use Regex::PreSuf; my @step4list =qw( al able ance ant ate ence ent ement er ible ic ism iti ive ize ment ou ous ); grep $_=reverse, @step4list; print "4p1s0r:", presuf ({suffixes=>0}, @step4list), "\n"; print "4p1s1r:", presuf ({suffixes=>1}, @step4list), "\n"; print "4p0s1r:", presuf ({prefixes=>0}, @step4list), "\n";