Slight optimization to skip some of the unneeded regex matching.