如何删除里面的所有内容<字符串>与<>一起烧焦 [英] How to remove everything that inside < String > together with the <> char

查看:54
本文介绍了如何删除里面的所有内容<字符串>与<>一起烧焦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<pre lang="HTML">

Hello CodeProjecters,



首先,我我要说谢谢,因为你花时间看看我的问题。



这里是我的问题,如何删除字符串和标签在<>里面,它只是简单的HTML标签,



我尝试使用这样的正则表达式:<。*?>如果样式是这样的话它也不会起作用:<! - if [end if] - >或者< m:blabla xmlns:m =#unknown/>或者< div id =divclass>



非常感谢在这里发布答案的人。

Hello CodeProjecters,

first of all, i'm going to say thanks because you have taking the time to take a look at my question.

here is my question, how do i remove the string and the tags together that inside "<>", it's just simple HTML tags,

i've tried using regex pattern like this : <.*?> and it also wont work, if the style is like this : <!--if [end if] --> or < m:blabla xmlns:m="#unknown" /> or < div id="divclass" >

many thanks to the one that have post an answer here.

推荐答案

尝试使用

try with
String res= Regex.Replace(htmlInput, @"<[^>]*>", String.Empty);





更新:



如果你想同时删除<>和{}使用 @< [^>] *> | {[^>] *}


您也可以使用我的 StringParser [ ^ ]上课为你做这个。



/ ravi
You could also use my StringParser[^] class to do this for you.

/ravi


这样的东西?

删除所有HTML标记并仅在内部显示纯文本(如果XML格式不正确) [ ^ ]



请务必查看原始提示和其他替代方案。
Something like this?
Remove all the HTML tags and display a plain text only inside (in case XML is not well formed)[^]

Be sure to look at the original Tip and the other alternatives.


这篇关于如何删除里面的所有内容&lt;字符串&gt;与&lt;&gt;一起烧焦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆