Factor out regex guessing, always take action if provided.