Home>

Not much nonsense,All in the code,Directly on

js code:

<html>
<head>
<script language="javascript">
 var a="<p><a href=\" ~ abc/ccg/ab.jpg \ "width =" 3 ">text</a><a width =" 4 "mm_href =" http :www.google.com "href =" "mce_href =">href="" cbas<span>cchref&/;span>1<a dd href="ccc"<a width="5" href=" "mce_href =";
 var b=/<a ([\ s] + | [\ s] + [^<>] + [\ s] +) href=(\ "([^<>" \ "] * ) \ "| \" ([^<>"\"] *) \ ") [^<>] *>/gi;
 var s=a.tolowercase (). match (b);
 alert (s.length);
 for (var i=0;i<s.length;i ++)
 {
 var ss=s [i] .tolowercase (). match (b);
 alert (regexp. $3 + regexp. $4);
 }
</script>
</head>
<body>
</body>
</html>

c#code:

string html="<p><a href =" ~ abc/ccg/ab.jpg "height=\" 4 \ "width =" 3 ">text</a><a width=\" 4 \ "style=\" color:#ddd;font-weight:bold;\ "mm_href=\" http:www.google.com \ "href=\" "mce_href=\"&href;\ "" cbas<span>cchref</span>1<a df href=\ "cc \"<a width=\ "5 \" href=\ "" mce_href=\ ">";
regex reg=new regex ("<a ([\\ s] + | [\\ s] + [^<>] + [\\ s] +) href=(\" (?< ;href>[^<>\ ""] *) \ "|" (?<href>[^<>\ ""] *) ") [^<>] *>", regexoptions.ignorecase);
matchcollection matchcollection=reg.matches (html);
messagebox.show (matchcollection.count.tostring ());
foreach (match match in matchcollection)
{
 messagebox.show (match.groups ["href"]. tostring ());
}
  • Previous Small Drupal database backup and large site MySQL backup strategy sharing
  • Next Parsing Java's InputStream class and using it to read ppt files