Write a function that returns past tense of given verb Challenge


  Write a function which takes an argument which is a verb, and returns the past tense of the verb. (Assume that the verb is regular)


Past tense

Note: consider y as neither consonant nor vowel. 

Normally, just adding ed after the end of verb makes the past tense of the verb.

Ex: jump → jumped, ask → asked

However, there are other rules.


If the last character of the given verb is e, just add d.

Ex: love → loved, move → moved
If the verb is ended with a consonant + y, then change y to i, and add ed.

Ex: study → studied, cry → cried
However, if the verb is ended with a vowel + y, then just add ed.

Ex: play → played, stay → stayed
If a verb is ended with a vowel and a consonant, then write the consonant one more time, and add ed.

Ex: stop → stopped, plan → planned
However, if a verb is ended with multiple vowels + a consonant or single vowel + multiple consonants, then just add ed.

Ex: look → looked, jump → jumped


There are more rules but let's care above rules only. For example, according to above rule, visit → visitted.

Winner

Since this is code golf, the shortest code that correctly returns past tenses wins.

Example (JS, 127)

function f(x){return x.replace(/([^aeiouy])y$/,'$1i').replace(/([^aeiouy][aeiou])([^aeiouy])$/,'$1$2$2').replace(/e$/,'')+'ed'}
sed, 76 characters

Does a sed script count as a function for this problem?

s/\([^aeiou]\)y$/\1i/
s/\([^aeiou][aeiou]\)\([^aeiouy]\)$/\1\2\2/
s/e\?$/ed/