|XP is just a number|
Another regex to solve ...by pat_mc (Pilgrim)
|on Aug 18, 2011 at 16:27 UTC||Need Help??|
pat_mc has asked for the
wisdom of the Perl Monks concerning the following question:
Esteemed monks ...
Here's an easy regex question for you ... or is it (I mean: 'easy')?
I want to detect all words ending in a vowel followed by the letter 'p'. So far so good. However, I only want the regex to match those words that do not have a double vowel. The regex should thus match 'step' and 'tip' but not 'stoop' or 'steep'. To me it looks like a combination of backreference and look-behind should do the trick ... just how, though, I can't get together. Can you please advise?
Thanks in advance and kind regards -
I tried something to the extent of /(?<!\1)([aeiou])p$/ but, of course, this did not work since the variable length look-behind is not available in the - admittedly very old - version of Perl that I'm using.