Can you help me to understand this code line by line please?
def word(w)
pattern = re.compile(r'^[^aeiouAEIOU]+')
if re.findall(r'[^aeiouAEIOU]y[^aeiouAEIOU]', w):
pattern = re.compile(r'^[^aeiouAEIOUy]+')
beginning = re.findall(pattern, word)
w = pattern.sub('', w)
w += str(beginning[0]) + 'ay'
return w
For me this part is confusing : [^aeiouAEIOU]y[^aeiouAEIOU]
Thanks!