日期:2014-05-18  浏览次数:20676 次

请教一个正则表达式,谢谢
<table   cellspacing= "0 "   class= "traffic_table "> <tr> <th> Yesterday </th> <th> 1   wk.   Avg. </th> <th> 3   mos.   Avg. </th> <th> 3   mos.   Change </th> </tr> <tr> <td> <!--Did   you   know?   Alexa   offers   this   data   programmatically.     Visit   http://aws.amazon.com/awis   for   more   information   about   the   Alexa   Web   Information   Service.--> 0.03 <span   class= "cbb0 "> % </span> </td> <td> <!--Did   you   know?   Alexa   offers   this   data   programmatically.     Visit   http://aws.amazon.com/awis   for   more   information   about   the   Alexa   Web   Information   Service.--> 0 <span   class= "c0f4 "> .0 </span> 3% </td> <td> <!--Did   you   know?   Alexa   offers   this   data   programmatically.     Visit   http://aws.amazon.com/awis   for   more   information   about   the   Alexa   Web   Information   Service.--> 0 <span   class= "c34f "> 3 </span> .0 <span   class= "c12a "> 39 </span> <span   class= "ce1e "> 41 </span> <span   class= "c8ff "> 10 </span> 6 <span   class= "cc64 "> 5% </span> </td> <td> <img   alt= "down "   border= "0 "   height= "11 "   width= "13 "   src= "http://client.alexa.com/common/images/down_arrow.gif "> &nbsp; <!--Did   you   know?   Alexa   offers   this   data   programmatically.     Visit   http://aws.amazon.com/awis   for   more   information   about   the   Alexa   Web   Information   Service.--> <span   class= "c712 "> 69 </span> <span   class= "c5c7 "> 34 </span> <span   class= "cb82 "> 6 </span> <span   class= "cca5 "> % </span> </td> </tr> </table>


我想把 <>   都去掉,但要保留   <span   class= " ">   </span> ,请问这个正则表达式怎么写?谢谢


------解决方案--------------------
是这样吗?
<span class= ".*? "> .*? </span>
结果:
<span class= "cbb0 "> % </span>
<span class= "c0f4 "> .0 </span>
<span class= "c34f "> 3 </span>
<span class= "c12a "> 39 </span>
<span class= "ce1e "> 41 </span>
<span class= "c8ff "> 10 </span>
<span class= "cc64 "> 5% </span>
<span class= "c712 "> 69 </span>
<span class= "c5c7 "> 34 </span>
<span class= "cb82 "> 6 </span>
<span class= "cca5 "> % </span> <span class= "cbb0 "> % </span>
<span class= "c0f4 "> .0 </span>
<span class= "c34f "> 3 </span>
<span class= "c12a "> 39 </span>
<span class= "ce1e "> 41 </span>
<span class= "c8ff "> 10 </span>
<span class= "cc64 "> 5%