首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

过滤字符串中连续数字有关问题

2013-01-25 
过滤字符串中连续数字问题Regex regex1 new Regex(@\d{7,18})html regex1.Replace(divstrong

过滤字符串中连续数字问题
            Regex regex1 = new Regex(@"\d{7,18}");
            html = regex1.Replace("<div>   <strong>好了</strong><img src='http://www.baidu.com/images/aa/123456789.gif' >   <div>  <b>好了</b>   专家:010-64021966QQ:2416144277   <p>        <nobr>          <span></span>        </nobr>      </p>      <p>        </div>", ""); 
想过qq号码和电话,结果连图片的数字也过滤了,怎么写才能只过滤标签外的

[解决办法]
Regex regex1 = new Regex(@"(?<=>[^<>]*?)\d{7,18}(?=[^<>]*?<)");
[解决办法]

引用:
Regex regex1 = new Regex(@"(?<=>[^<>]*?)\d{7,18}(?=[^<>]*?<)");

++1

热点排行