string SingleUrl = "";
ArrayList TemArryList = new ArrayList();
//定义正则表达式
string regexstr = @"(src=)('|" + System.Convert.ToChar(34) + "| )?(http://)(.[^'|" + @"\s|" + System.Convert.ToChar(34) + "]*)" + @"(\.)(jpg|gif|png|bmp|jpeg|JPG|GIF|PNG|BMP|JPEG)('|" + System.Convert.ToChar(34) + "|" + @"\s|>)?";
Regex reg = new Regex(regexstr, RegexOptions.Compiled);
MatchCollection Matchcollage = reg.Matches(Str);
//匹配正则表达式
foreach (Match Matchs in Matchcollage)
{
SingleUrl = Matchs.Result("$3$4$5$6");
if (SingleUrl.LastIndexOf(".") != 0)
{
TemArryList.Add(SingleUrl);
}
}
return TemArryList;
}
3.2.3 图片数据获取及图片上传模块
/// <summary>
/// 远程读取单图片数据并上传到服务器
/// </summary>
/// <param name="Url">图片Url地址</param>
/// <returns>返回上传图片路径</returns>
private string ReadWriteRemoteData(string Url)
{
try
{
//定义XMLhttp对象
MSXML2.XMLHTTP _XMLhttp = new MSXML2.XMLHTTPClass();
//初始化对象
_XMLhttp.open("GET", Url, false, null, null);
_XMLhttp.send("");
|