着急:有关截取字符串的问题! 我有一个类似字符串,比如:<FONT color=#3333cc>[email protected]</font>我想取出这部分内容:[email protected],应该怎么取?求救大家,谢谢了!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 [a-zA-Z0-9_+.-]+\\@([a-zA-Z0-9-]+\\.)+[a-zA-Z0-9]{2,4}这这个正则 假如你要获取的是上面有规律的:(?<=<font[^>]*>)(?=</font>) (?is)(?<=<font[^>]*>)(?=</font>) 可以考虑给个label装这个东西,然后去label的值 string str = "<FONT color=#3333cc>[email protected]</font>"; str = str.Substring(str.IndexOf(">")+1, str.Length - str.IndexOf(">")-1); str = str.Substring(0,str.IndexOf("<")); void Main(){ string html="<FONT color=#3333cc>[email protected]</font>"; foreach(Match m in Regex.Matches(html,"(?i)(?<=<FONT[^>]*?>)[^<>]+(?=</font>)")) { Console.WriteLine(m.Value); } //[email protected]} hen_ai_hen_ai_ni,能不能写个完整的代码,谢谢了。 TO:q107770540,可是,不一定是<font></font> 也有可能是<a href=></a> 这种等等 v那就修改一下: foreach(Match m in Regex.Matches(html,"(?i)(?<=<[^>]*?>)[^<>]+(?=</[^>]*?>)")) 再简化一下: foreach(Match m in Regex.Matches(html,"(?<=>)[^<>]+(?=<)")) 关于TcpClient传输数据 事务(进程 ID XX)与另一个进程已被死锁在 thread | communication buffer 资源上【急求帮助】 c#做一个工具,用WPF 求一查询sql TabControl控件的简单问题,你可以解答么 CheckedListBox的ReadOnly 关于系统架构 关于报表 在CS文件中怎么样接收ASP.NET页面传的参数 怎样获得 DataSet 中的记录总数呀??? 。net可以上传所有格式文件,多文件上传并显示进度条,测试通过测试的,免费的 winform 根据指定的tag选中该checkbox
(?<=<font[^>]*>)(?=</font>)
str = str.Substring(str.IndexOf(">")+1, str.Length - str.IndexOf(">")-1);
str = str.Substring(0,str.IndexOf("<"));
void Main()
{
string html="<FONT color=#3333cc>[email protected]</font>";
foreach(Match m in Regex.Matches(html,"(?i)(?<=<FONT[^>]*?>)[^<>]+(?=</font>)"))
{
Console.WriteLine(m.Value);
}
//[email protected]}