在 VB.Net 2.0 中停止正则表达式(对于 ASP.Net)
我正在运行此正则表达式的简单版本:
<p\s*>(?:&(?:nbsp|\#0*160|x0*A0);|(?:<br\s*/?>)|[\s\u00A0]+)*</p>
在此字符串上:
<p>paste in some bullets from word...</p><p>Firefox:</p><p>Bulleted list test:</p><ul><li>One </li><li>Two <ul><li>Sub item one </li><li>Sub 2 <ul><li>Subsub item1 </li><li>Subsub2</li></ul></li><li>Sub3</li></ul></li><li>Three </li><li>Four</li></ul><p>Ordered list test:</p><ol><li>one </li><li>two <ol><li>sub 1 </li><li>sub 2</li></ol></li></ol><p> i. subsub 1</p><p> ii. subsub 2</p><ol start="2"><ol start="3"><li>sub 3</li></ol><li>three </li><li>four</li></ol><p>test</p><p>IE6</p><p>Bulleted list test:</p><ul style="list-style-type: disc;"><li>One</li><li>Two<ul style="list-style-type: circle;"><li>Sub item one</li><li>Sub 2<ul style="list-style-type: square;"><li>Subsub item1</li><li>Subsub2</li></ul></li><li>Sub3</li></ul></li><li>Three</li><li>Four</li></ul><p> </p><p>Ordered list test:</p><ol style="list-style-type: decimal;"><li>one</li><li>two<ol style="list-style-type: lower-alpha;"><li>sub 1</li><li>sub 2</li></ol></li></ol><p> i. subsub 1</p><p> ii. subsub 2</p><ol style="list-style-type: decimal;" start="2"><ol style="list-style-type: lower-alpha;" start="3"><li>sub 3</li></ol><li>three</li><li>four</li></ol><br />
该过程峰值达到 100%,看似无穷大。 我必须用正则表达式冗余/递归地做一些事情,但我不确定是什么。 在测试 Expresso 中的正则表达式 时,它表现出相同的行为。
I'm running a simpler version of this regex:
<p\s*>(?:&(?:nbsp|\#0*160|x0*A0);|(?:<br\s*/?>)|[\s\u00A0]+)*</p>
On this string:
<p>paste in some bullets from word...</p><p>Firefox:</p><p>Bulleted list test:</p><ul><li>One </li><li>Two <ul><li>Sub item one </li><li>Sub 2 <ul><li>Subsub item1 </li><li>Subsub2</li></ul></li><li>Sub3</li></ul></li><li>Three </li><li>Four</li></ul><p>Ordered list test:</p><ol><li>one </li><li>two <ol><li>sub 1 </li><li>sub 2</li></ol></li></ol><p> i. subsub 1</p><p> ii. subsub 2</p><ol start="2"><ol start="3"><li>sub 3</li></ol><li>three </li><li>four</li></ol><p>test</p><p>IE6</p><p>Bulleted list test:</p><ul style="list-style-type: disc;"><li>One</li><li>Two<ul style="list-style-type: circle;"><li>Sub item one</li><li>Sub 2<ul style="list-style-type: square;"><li>Subsub item1</li><li>Subsub2</li></ul></li><li>Sub3</li></ul></li><li>Three</li><li>Four</li></ul><p> </p><p>Ordered list test:</p><ol style="list-style-type: decimal;"><li>one</li><li>two<ol style="list-style-type: lower-alpha;"><li>sub 1</li><li>sub 2</li></ol></li></ol><p> i. subsub 1</p><p> ii. subsub 2</p><ol style="list-style-type: decimal;" start="2"><ol style="list-style-type: lower-alpha;" start="3"><li>sub 3</li></ol><li>three</li><li>four</li></ol><br />
And the process spikes to 100% for seemingly infinity. I must be doing something redundantly/recursively with the regex but I'm not sure what. It exhibits the same behavior when testing the regex in Expresso.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这似乎解决了这个问题:
我认为“+”太多余了。
This seems to fix it:
I think that the '+' was too redundant.