Conjugate in the Spanish imperfect / Conjugue en el imperfecto de indicativo Given an input of a Spanish verb in its infinitive form, output the verb
conjugated in all 6 forms of the indicative imperfect.

To conjugate an infinitive in the imperfect, remove the infinitive ending (-ar,
-er, -ir, and sometimes -ír) and add the imperfect endings listed below. There
are three irregular verbs in the imperfect, also listed below.

Verb ending    Replace with...
--------------------------------------------------------
-ar            -aba, -abas, -aba, -ábamos, -abais, -aban
-er, -ir, -ír  -ía,  -ías,  -ía,  -íamos,  -íais,  -ían




Irreg. verb    Conjugations
--------------------------------------------------------
ser            era,  eras,  era,  éramos,  erais,  eran
ver            veía, veías, veía, veíamos, veíais, veían
ir             iba,  ibas,  iba,  íbamos,  ibais,  iban


For the purposes of this challenge, use capital letters instead of accented
letters (á becomes A, é becomes E, and í becomes I). This is only because
accented letters are 2 bytes in UTF-8, but they can be different in other
encodings, and I'd rather not have to deal with any of that and stay within
printable ASCII instead.

Infinitive verbs will always be three or more characters long with the sole
exception of the verb ir, will never contain accented letters with the
exception of verbs that end in -ír, and will always end in either -ar, -er,
-ir, or -ír.  Reflexive verbs do not need to be handled.

Output may be in either the form of a whitespace-/comma-separated string (so
printing each conjugation to STDOUT on its own line is okay) or an
array/list/etc.

Since this is code-golf, the shortest code in bytes wins.

Test cases:

In       Out
---------------------------------------------------------------
hablar   hablaba hablabas hablaba hablAbamos hablabais hablaban
comer    comIa comIas comIa comIamos comIais comIan
vivir    vivIa vivIas vivIa vivIamos vivIais vivIan
sonreIr  sonreIa sonreIas sonreIa sonreIamos sonreIais sonreIan
ser      era eras era Eramos erais eran
ver      veIa veIas veIa veIamos veIais veIan
ir       iba ibas iba Ibamos ibais iban
Retina, 100 82 bytes

\B[^a]r$
I
r$
b
^vI$
veI
^sI$
er
$
a
$
 $_s $_ $_mos $_is $_n
T`l`L`.(?=[^I]amos )


Try it online. Unfortunately, due to the use of $_ it's not possible to modify the code to run all tests at once, so you'll have to copy in the individual verbs. I'm working on a new feature that will make this possible though.

Explanation

\B[^a]r$
I


We start by turning all endings which aren't ar into I, provided the input isn't the irregular verb ir. That takes care of the -er, -ir, -ír conjugations, messes up the irregular verbs ser and ver (but shortens them in the process), and leaves only ir and -ar with a trailing r.

r$
b


If the word still ends in r, we replace that with a b. We've now covered all standard conjugations as well as the irregular verb ir.

^vI$
veI


This fixes the irregular verb ver which has been turned into vI in the first stage.

^sI$
er


This fixes the irregular verb ser which has been turned into sI in the first stage. Now we've modified all possible stems correctly. All that's left to do is append all the possible endings, and then fix the accent for the first person plural in some cases.

$
a


First we append an a to the stem, because that's always part of all endings.

$
 $_s $_ $_mos $_is $_n


This makes use of the rarely seen $_ which inserts the entire string into the substitution (regardless of what was matched). This is actually very useful when duplicating strings, as are $` and $', which are also quite underappreciated.

Before this stage, we've got the first person singular in the string. We now append the other conjugations, by matching the end of the string with $ and building the other forms by appending the appropriate suffixes to the first person singular.

T`l`L`.(?=[^I]amos )


Finally, we fix the accent for the first person plural if applicable. This only needs to be done for a vowel, two characters in front of the -amos unless the character in between is I. So we match such a character and then use a transliteration stage to convert lower to upper case. This makes use of the new character classes l and L which I only added yesterday. They expand to a-z and A-Z respectively, so that new feature saves 4 bytes here.