求一个正则表达式!!

jfengersy 2007-05-23 11:51:41
<table>
<tr>
<td>
{tags:loop column="1"}
<table id="table1" width="100%" style="font-size:12px;" border="0"
<tr><td></td></tr>
</table>
{/tags:loop}
</td>

<td>
{tags:loop column="1"}
<table id="table2" width="100%" style="font-size:12px;" border="0" align="center" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
</table>
{/tags:loop}
</td>
</tr>
</table>
================================
我是这样写的:{tags:loop[^{}]+?\}(.|\n)*{/tags:loop}
这种写法是错误的。。。我想写一个分别取出两个:{tags:loop column="1"}{/tags:loop}标签
真确取出后结果应该是这样:
{tags:loop column="1"}
<table id="table1" width="100%" style="font-size:12px;" border="0"
<tr><td></td></tr>
</table>
{/tags:loop}

{tags:loop column="1"}
<table id="table2" width="100%" style="font-size:12px;" border="0" align="center" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
</table>
{/tags:loop}

请各位帮帮忙。。。万分感谢。。。
...全文
119 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
jfengersy 2007-05-23
  • 打赏
  • 举报
回复
恩,明白!试试看。。。先给分
weizhuangzhi 2007-05-23
  • 打赏
  • 举报
回复
另外如果是我说的第二种方法的话,那正则要改为:

{tags:loop[^{}]+?\}(.|\n)*?{/tags:loop}
weizhuangzhi 2007-05-23
  • 打赏
  • 举报
回复
如果只有两个可以再复制一下表达式,中间用.*,两边用()括出来,做为子匹配,然后再合并

如果是多个的话,那就只需要一下表达式,从匹配到的集合中串接起来。
Qim 2007-05-23
  • 打赏
  • 举报
回复
sf

62,052

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧