Counting the number of syllables in a words with the exception that in words that end with "es","ed" are not counted as a syllable

You can use

(?i)(?!e[ds]\b)[aeiou]
(?![eE][DdsS]\b)[aeiouAEIOU]

See the regex demo. Details:

  • (?i) - enable case insensitive matching
  • (?!e[ds]\b) - no match if there are ed or es followed with a word boundary immediately on the right
  • [aeiou] - one of the letters listed in the char set.

See the Python demo:

import re
vowelRegex = re.compile(r'(?!e[ds]\b)[aeiou]', re.I)
print(vowelRegex.findall('RoboCoped eatsed babyes food. BABY FOOD.'))
print(vowelRegex.sub(r'(\g<0>)', 'RoboCoped eatsed babyes food. BABY FOOD.'))

Output:

['o', 'o', 'o', 'e', 'a', 'a', 'o', 'o', 'A', 'O', 'O']
R(o)b(o)C(o)ped (e)(a)tsed b(a)byes f(o)(o)d. B(A)BY F(O)(O)D.