= Solution
\b[K is ethyl 4-(4-methylbenzoyl)-1H-pyrrole-2-carboxylate.] AlCl$_3$ activates the aroyl chloride to an acylium-like <electrophile>. Pyrrole attacks through C4, forming a sigma complex; deprotonation restores <aromaticity> and work-up releases the <ketone> from its Lewis-acid complex.
Unsubstituted pyrrole normally favours an $\alpha$ position, but the <ester> at C2 changes the regioselectivity. Attack at C5, or at C3, permits important sigma-complex contributors with positive charge at the ester-bearing C2, which is strongly destabilized by the electron-withdrawing <ester>. C4 substitution avoids that particularly unfavourable contributor. \b[The C2 <ester> therefore directs the acylation towards C4], overriding the simple unsubstituted-pyrrole rule. Combining the starting <ester> with a p-toluoyl group while replacing a ring hydrogen gives $\mathrm{C_{15}H_{15}NO_3}$, as required.
Back to article page