Sem dizer muita bobagem, está tudo no código, basta fazer o upload
Código JS:
A cópia do código é a seguinte:
<html>
<head>
<Script Language = "JavaScript">
var a = '<p> <a href =/' ~ abc/ccg/ab.jpg/'> text </a> <a style = "cor: #ddd; font-weight: Bold;" mm_href = "http: www.baidu.com" href = "http://bbs.cn.yimg.com/user_img/200701/31/Soso1.jpg" mce_href = "http://bbs.cn.yimg.com/user_img/200701/31/jisuanji986_117025184198149.jpg"> cc </a> href = "ww.baidu.bas <nppg"> CC </a> href = "ww.baidu.bas" cbas <"cch". <a href = "http://bbs.cn.yimg.com/user_img/200701/31/sol.
var b =/<a ([/s]+| [/s]+[^<>]+[/s]+) href = (/"([^<>"/']*)/"|/' ([^<>"/']*)/') [^<>]*>/gi;
var s = a.TolowerCase (). Match (b);
alerta (comprimento s);
for (var i = 0; i <comprimento; i ++)
{
var ss = s [i] .tolowerCase (). Match (b);
alerta (regexp. $ 3+regexp. $ 4);
}
</script>
</head>
<Body>
</body>
</html>
Código C#:
A cópia do código é a seguinte:
string html = "<p> <a href = '~ abc/ccg/ab.jpg' altura =/" 4/"width = '3'> texto </a> <a largura =/" 4/"estilo =/" cor: #ddd; Fonte: Bold;/"mm_href =/" http: www.baidu.com/ "href =/" http://bbs.cn.yimg.com/user_img/200701/31/Soso1.jpg/ " MCE_HREF =/"http://bbs.cn.yimg.com/user_img/200701/31/jisuanji986_117025184198149.jpg/" cc </bpin> href =/"www.bedu.com" href =/"cc/" <a largura =/"5/" href =/"http://bbs.cn.yimg.com/user_img/200701/31/Soso2.jpg/" MCE_HREF =/"http://bbs.cn.yimg.com/user_img/200701/31/cc.jpg/"> </a> </p> ";
Regex reg = new regex ("<a ([// s]+| [// s]+[^<>]+[// s]+) href = (/" (? <href> [^<>/"']*)/" |' (?
MatchCollection MatchCollection = Reg.Matches (HTML);
MessageBox.Show (MatchCollection.Count.ToString ());
foreach (partida de partida no MatchCollection)
{
MessageBox.show (match.groups ["href"]. Tostring ());
}
Você entendeu as semelhanças e diferenças de usar expressões regulares em JS e C#? Se você tiver alguma dúvida, deixe uma mensagem e discuta juntos.