开发者

Regex: Scrub HTML

开发者 https://www.devze.com 2023-02-07 08:10 出处:网络
I have a bunch of 开发者_运维技巧HTML code where I want to remove all the HTML markup. I think this is possible with Regex (Regular expression). With search and replace, how would I do this?

I have a bunch of 开发者_运维技巧HTML code where I want to remove all the HTML markup.

I think this is possible with Regex (Regular expression). With search and replace, how would I do this?

I tried <*> where I thought * was a wildcard, but apparently not. How would I make regex find all the

< text > ?


A simple version would be:

<[^>]+>

[] defines a character class, ^ excludes characters. Here is an example.


Take a look at this: http://haacked.com/archive/2004/10/25/usingregularexpressionstomatchhtml.aspx


Select "Regular Expression" in Search Mode. Enter [<].*?> in Find What field and leave the Replace With field empty.

0

精彩评论

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

关注公众号