开发者

Problem with RegEx

开发者 https://www.devze.com 2023-01-16 07:05 出处:网络
I have a prob开发者_C百科lem with <tx:itypes\\b[^>]*>(.*?)</tx:itypes> It should replace the tag and everything inside. It works fine if it\'s just one line:

I have a prob开发者_C百科lem with

<tx:itypes\b[^>]*>(.*?)</tx:itypes>

It should replace the tag and everything inside. It works fine if it's just one line:

   <tx:itypes> some stuff here </tx:itypes>

But there's 15-20 lines with other tags inside < tx:itypes > How can I change it to remove everything? Thanks.


If you're using Perl-compatible regex, then the simplest route would be to add the s flag to your expression.

Otherwise, it's semi-common practice to use the [\d\D] to match any character regardless of line-ending:

<tx:itypes\b[^>]*>([\d\D]*?)</tx:itypes>
0

精彩评论

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