Throw exception if getIndex regex fails to match