开发者

How to remove all inline styled `style=properties+val` from every tag from a long source code?

开发者 https://www.devze.com 2022-12-24 00:24 出处:网络
How to remove all inline styled开发者_StackOverflow社区 style=properties+val from every tag from a long source code quickly.

How to remove all inline styled开发者_StackOverflow社区 style=properties+val from every tag from a long source code quickly.

For example.

<p style="border:2px red solid">some text</p>
<span style="background:red">some text</span>

to

<p>some text</p>
<span>some text</span>


Assuming your editor supports regular expression find and replace (and if it doesn't, get a new editor):

Find with this regular expression: \s?style="[^"]*"

Replace with: nothing!

Note that this will not catch instances where your code is malformed, as shown in your example (missing double quote at the end of the first style).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号