Prevent regexp back-refs from sometimes matching when they shouldn't