fix regex interpolation slowdown in matching

A recent commit (c255f1d) caused a 10x slowdown in one of my
projects. This commit fixes the slowdown without breaking any
spectests.

This is only a stopgap solution. Something more lasting will
also be needed in the regex engine, I think. But it does fix
the particular slowness I was experiencing.