using system.text.regularexpressions; |
regex urlregex = new regex(@"(http:////([/w.]+//?)/s*)", regexoptions.ignorecase|regexoptions.compiled); |
regex emailregex = new regex(@"([a-za-z_0-9.-][email protected][a-za-z_0-9.-]+/./w+)", regexoptions.ignorecase|regexoptions.compiled); |
private void button1_click(object sender, system.eventargs e) { string strcontent = inputtextbox.text; regex urlregex = new regex(@"(http:////([/w.]+//?)/s*)", regexoptions.ignorecase| regexoptions.compiled); strcontent = urlregex.replace(strcontent, "<a href="" target="_blank"></a>"); regex emailregex = new regex(@"([a-za-z_0-9.-][email protected][a-za-z_0-9.-]+/./w+)", regexoptions.ignorecase| regexoptions.compiled); strcontent = emailregex.replace(strcontent, "<a href=mailto:></a>"); lbcontent.text += "<br>"+strcontent; } |
新闻热点
疑难解答
图片精选