0
我收到Web响应并尝试在其中查找ID。 我写道:RegEx返回空字符串
HttpWebResponse response = (HttpWebResponse)httpWReq.GetResponse();
Stream receiveStream = response.GetResponseStream();
StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8);
var regex = new Regex(@"([0-9]+)(?=\) title=)");
return regex.Match(readStream.ToString()).ToString(); //suppose there is a problem
出了什么问题?
如果您向我们提供了'readStream.ToString()'的内容,它可能会有所帮助,这可能不是您认为的内容。 – Rawling
'readStream.ToString()'将返回'System.IO.StreamReader' - 不是流的内容。尝试使用'readStream.ReadToEnd()'代替。 – samjudson