check origin attribute exists before regex on it