I am trying to replace 'eed' and 'eedly' with 'ee' with words where there is a vowel before any term appears ('eed' or 'eedly') .
So, for example, the word indeed will become indee , because there is a vowel ('i') that occurs before 'eed'. On the other hand, the word 'feed' would not change because there is no vowel before the suffix 'eed' .
I have this regular expression: (?i)([aeiou]([aeiou])*[e{2}][d]|[dly]\\b) You can see what happens with this here .
As you can see, this correctly identifies words that end in 'eed' , but it does not correctly identify 'eedly' .
Also, when he replaces, he replaces all words ending in 'eed' , even words such as feed , which he should not delete eed
What should I consider here in order to correctly identify words based on the rules that I have indicated?
source share