我有一个字符串与html内容.我想用javascript正则表达式删除标签上的style属性style,如下所示:
之前
<style style="color: red;">
后
<style>
你能帮助我吗 ?
$input = '<style style="color: red;">';
$output = preg_replace('/(<[^>]+) style=".*?"/i', '$1', $input);
echo $output;
Run Code Online (Sandbox Code Playgroud)
输出将是这样的
<style>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7050 次 |
| 最近记录: |