Goodness... working with OLD tools... alright.
How about removing all vowels from the string and checking how many characters you lost?
select user_name,
length( user_name) -
length (replace (
replace (
replace (
replace (
replace (upper(user_name)
, 'A', '')
, 'E', '')
, 'I', '')
, 'U', '')
, 'O', '')
) vowel_count_stoneage,
OCCURRENCES_REGEXPR ( '[aeiou]' FLAG 'i' in user_name) as VOWEL_COUNT
from public.users;
Not as fancy, but does it's job.
- Lars