Regex Validator - 检测除特定HTML标记之外的所有标记 [英] Regex Validator - detect all but certain HTML tags

查看:94
本文介绍了Regex Validator - 检测除特定HTML标记之外的所有标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



大家好......希望有人可以提供帮助。


不是一个独特的情况,但我对解决方案的搜索没有产生/>
我还需要什么。


我正在尝试为一个

RegularExpressionValidator提供一个正则表达式,它将允许某些HTML标记:


< a>,< b>,< blockquote>,< br>,< i>,< img>,< li>, < ol>,< p>,< quote>,

< ul>


但阻止他人。所以基本上我想要检测<然后寻找

某些序列(上面的标签)。但我当然也要为
帐户提供任意数量的可能属性。然后上面的一些

标签有结束标签,有些没有。


我不完全理解正则表达式,但想学习;

但是,我也希望尽快找到一种方法。


我不想重新发明这个特殊的轮子。如果你之前已经完成了

,如果你知道我的意思。 :)


任何人的帮助都会非常感激。谢谢

很多!


Barry L. Camp

解决方案

< blockquote> Barry,


当你不想发明轮子时,为什么你不使用为此发明的轮子

? />

MSHTML。

http://www.vb-tips.com/dbpages.aspx?...f-56dbb63fdf1c


我希望这会有所帮助,


Cor


" Barry L. Camp" < bl **** @ gmail.comschreef in bericht

news:11 ********************* @ l53g2000cwa.googlegro ups .com ...


>

大家好......希望有人可以提供帮助。


不是一个独特的情况,但我找到的解决方案还没有产生我需要的价格。


我想来正则表达式为

RegularExpressionValidator,它将允许某些HTML标记:


< a>,< b>,< blockquote>, < br>,< i>,< img>,< li>,< ol>,< p>,< quote>,

< ul>


但阻止他人。所以基本上我想要检测<然后寻找

某些序列(上面的标签)。但我当然也要为
帐户提供任意数量的可能属性。然后上面的一些

标签有结束标签,有些没有。


我不完全理解正则表达式,但想学习;

但是,我也希望尽快找到一种方法。


我不想重新发明这个特殊的轮子。如果你之前已经完成了

,如果你知道我的意思。 :)


任何人的帮助都会非常感激。谢谢

很多!


Barry L. Camp





我需要找一个正则表达式验证器的正则表达式来执行我所描述的




我不是对解析网页感兴趣。我正在尝试解析文本框中的

内容 - 我有一个DetailsView控件,其中一个

文本框用于可能显示在.aspx中的内容页。我希望

允许某些标签,但阻止所有其他标签。 DetailsView被绑定到一个ObjectDataSource,所以很自然地,如果可能的话,让

Validator为我捕获所有内容会很好。

任何想法(任何人)?


谢谢,


Barry

Cor Ligthert [MVP ]写道:


巴里,


当你不想发明轮子时,为什么你不使用轮子

是为此发明的?


MSHTML。

http://www.vb-tips.com/dbpages.aspx?... f-56dbb63fdf1c


我希望这会有所帮助,


Cor


" ; Barry L. Camp < bl **** @ gmail.comschreef in bericht

news:11 ********************* @ l53g2000cwa.googlegro ups .com ...



大家好......希望有人可以提供帮助。


不是独特的情况,但我找到的解决方案还没有产生我需要的价格。


我正在努力想出一个正则表达式a / $
RegularExpressionValidator将允许某些HTML标记:


< a>,< b>,< blockquote>,< br>,< ; i>,< img>,< li>,< ol>,< p>,< quote>,

< ul>


但阻止其他人。所以基本上我想要检测<然后寻找

某些序列(上面的标签)。但我当然也要为
帐户提供任意数量的可能属性。然后上面的一些

标签有结束标签,有些没有。


我不完全理解正则表达式,但想学习;

但是,我也希望尽快找到一种方法。


我不想重新发明这个特殊的轮子。如果你之前已经完成了

,如果你知道我的意思。 :)


任何人的帮助都会非常感激。谢谢

很多!


Barry L. Camp


Barry L. Camp < bl **** @ gmail.comwrote in news:1169470557.654043.70840

@ a75g2000cwd.googlegroups.com:


I'对解析网页不感兴趣。我正在尝试解析文本框中的

内容 - 我有一个DetailsView控件,其中一个

文本框用于可能显示在.aspx中的内容页。我希望

允许某些标签,但阻止所有其他标签。 DetailsView被绑定到一个ObjectDataSource,所以很自然地让

Validator尽可能地为我捕获所有内容。



您可以将文本框内容加载到MSHTML中。


查找正则表达式来处理HTML的所有情况将是

至少可以说 - 我建议你再看看MSHTML

,看看它是否能正常工作。



Hi all... hope someone can help out.

Not a unique situation, but my search for a solution has not yielded
what I need yet.

I''m trying to come up with a regular expression for a
RegularExpressionValidator that will allow certain HTML tags:

<a>, <b>, <blockquote>, <br>, <i>, <img>, <li>, <ol>, <p>, <quote>,
<ul>

but block others. So basically I''d like to detect "<" then look for
certain sequences (the tags above). But I also of course have to
account for any number of possible attributes. And then some of the
tags above have closing tags, others do not.

I don''t fully understand regular expressions, yet would like to learn;
however, I also want to find a way to do this soon.

I don''t want to reinvent this particular "wheel" if it has already been
done before, if you know what I mean. :)

Any help from anyone out there would be greatly appreciate. Thanks
Much!

Barry L. Camp

解决方案

Barry,

When you do not want to invent the wheel, than why do you not use the wheel
that is invented for this?

MSHTML.

http://www.vb-tips.com/dbpages.aspx?...f-56dbb63fdf1c

I hope this helps,

Cor

"Barry L. Camp" <bl****@gmail.comschreef in bericht
news:11*********************@l53g2000cwa.googlegro ups.com...

>
Hi all... hope someone can help out.

Not a unique situation, but my search for a solution has not yielded
what I need yet.

I''m trying to come up with a regular expression for a
RegularExpressionValidator that will allow certain HTML tags:

<a>, <b>, <blockquote>, <br>, <i>, <img>, <li>, <ol>, <p>, <quote>,
<ul>

but block others. So basically I''d like to detect "<" then look for
certain sequences (the tags above). But I also of course have to
account for any number of possible attributes. And then some of the
tags above have closing tags, others do not.

I don''t fully understand regular expressions, yet would like to learn;
however, I also want to find a way to do this soon.

I don''t want to reinvent this particular "wheel" if it has already been
done before, if you know what I mean. :)

Any help from anyone out there would be greatly appreciate. Thanks
Much!

Barry L. Camp




I need to find a regex for Regular Expression Validator to perform what
I am describing.

I''m not interested in parsing a web page. I''m trying to parse the
contents of a textbox - I have a DetailsView control, for which one
textbox is for content that may be displayed in an .aspx page. I want
to allow certain tags, but block all others. The DetailsView is bound
to an ObjectDataSource, so naturally it would be nice to have the
Validator catch everything for me if at all possible.

Any ideas (anyone)?

Thanks,

Barry
Cor Ligthert [MVP] wrote:

Barry,

When you do not want to invent the wheel, than why do you not use the wheel
that is invented for this?

MSHTML.

http://www.vb-tips.com/dbpages.aspx?...f-56dbb63fdf1c

I hope this helps,

Cor

"Barry L. Camp" <bl****@gmail.comschreef in bericht
news:11*********************@l53g2000cwa.googlegro ups.com...


Hi all... hope someone can help out.

Not a unique situation, but my search for a solution has not yielded
what I need yet.

I''m trying to come up with a regular expression for a
RegularExpressionValidator that will allow certain HTML tags:

<a>, <b>, <blockquote>, <br>, <i>, <img>, <li>, <ol>, <p>, <quote>,
<ul>

but block others. So basically I''d like to detect "<" then look for
certain sequences (the tags above). But I also of course have to
account for any number of possible attributes. And then some of the
tags above have closing tags, others do not.

I don''t fully understand regular expressions, yet would like to learn;
however, I also want to find a way to do this soon.

I don''t want to reinvent this particular "wheel" if it has already been
done before, if you know what I mean. :)

Any help from anyone out there would be greatly appreciate. Thanks
Much!

Barry L. Camp


"Barry L. Camp" <bl****@gmail.comwrote in news:1169470557.654043.70840
@a75g2000cwd.googlegroups.com:

I''m not interested in parsing a web page. I''m trying to parse the
contents of a textbox - I have a DetailsView control, for which one
textbox is for content that may be displayed in an .aspx page. I want
to allow certain tags, but block all others. The DetailsView is bound
to an ObjectDataSource, so naturally it would be nice to have the
Validator catch everything for me if at all possible.

You can load the textbox contents into MSHTML.

Finding a regular expression to handle all the cases of HTML will be
challenging to say the least - I suggest you take a look at MSHTML again
and see if it''ll work.


这篇关于Regex Validator - 检测除特定HTML标记之外的所有标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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