62,074
社区成员
发帖
与我相关
我的任务
分享
var url = document.getElementById("img1").value;
string str="<IMG height=\"372\" alt=\"aa\" src=\"http://192.168.1.72/WebAdmin/images/image.jpg\" width=\"594\" border=\"0\" />";
XmlDocument xDoc = new XmlDocument();
xDoc.Load(new System.IO.MemoryStream(System.Text.Encoding.GetEncoding ("UTF-8").GetBytes (str)));
XmlNodeList xNode = xDoc.SelectNodes("//IMG");
{
for (int i = 0; i < xNode.Count; i++)
{
Response.Write ( xNode[i].Attributes["src"].Value);
}
}
Match m= Regex.Match("<IMG height=372 alt=aa src=\"http://192.168.1.72/WebAdmin/images/image.jpg\" width=594 border=0>","(?<=<img.+?src=\")[^\"]+(?=\")",RegexOptions.IgnoreCase);
string str=m.Value;
protected void Page_Load(object sender, EventArgs e)
{
string str = "<IMG height=372 alt=aa src=\"http://192.168.1.72/WebAdmin/images/image.jpg\" width=594 border=0>";
string[] temp;
string test = "src=\"(?<qs>[\\s\\S]*?)\"([\\s\\S]*?)>";
Regex reg = new Regex(test);
temp = new string[reg.Matches(str).Count];
int i = 0;
foreach (Match match in reg.Matches(str.Replace("\r", "").Replace("\n", "").Replace("\r\n", "")))
{
if (match.Success)
{
temp[i] = match.Groups["qs"].Value.ToString();
i++;
}
}
}