in reply to Re: Another regex to solve ... (\2)
in thread Another regex to solve ...

Here are some other ways to do it, including one that doesn't work and one that almost works...

local $_= "Up stop 'Oop' tip stoop put\nup, tops steep 'creap' sleep s +oap!"; my @words; push @words, $1 # Misses "up" if first word in string: # while /(\b\w*(?<=(.))(?!\2)[aeiou]p\b)/gi; # Would work if (?<=...|...) were smarter: # while /(\b\w*(?<=^|(.)(?!\2))[aeiou]p\b)/gsi; # How to work around (?<=...|...) being dumb: # while /(\b\w*(?:(?<=^)|(?<=(.)(?!\2)))[aeiou]p\b)/gsi; # (?<=^) can be shortened to just ^: while /(\b\w*(?:^|(?<=(.)(?!\2)))[aeiou]p\b)/gsi; # Or just skip the complex check for 2-letter words: # while /(\b(?:\w*(?<=(.))(?!\2))?[aeiou]p\b)/gsi; print "( @words )\n"; __END__ ( Up stop tip up creap soap )

- tye