vs 2008中的HTML标签标签正则表达式



我想询问正则表达问题。我想在VS 2008中搜索以下语法:

<table width="10%" class="test" style=""> </table> 
<table class="test" style="" width="10%">  </table> 
<table class="test" width="10%" style=""> </table> 
<table class="test" width="10%"></table> 
<table class="test"></table> 
<table></table> 
<div width="10%"></div>

我想在上表文本中搜索所有宽度=

搜索正则表达式

table[^w]+width="[^"]+"

搜索结果

<table width="10%" class="test" style=""> </table> 
<table class="test" style="" width="10%">  </table> 
<table class="test" width="10%" style=""> </table> 
<table class="test" width="10%"></table> 

我想将宽度替换为style =" width:"

结果应为

<table style="width:10%" class="test" style=""> </table> 
<table class="test" style="" style="width:10%">  </table> 
<table class="test" style="width:10%" style=""> </table> 
<table class="test" style="width:10%"></table> 

如何进行此更换?

在正则表达式下使用:

width="[^"]+"

[^"]匹配任何不 "的字符。

最新更新