开发者

Regex matching broadly after first match

I've got the following regex

<\?php\n//{{([^*]|[\r\n])*\?>

To match the following

<?php
//{{
...
?>

The problem is, once the regex matches this, it'll match the following

开发者_如何学Python<?php
...
?>

So basically, once it matches the //{{ it'll match any php tag after.

Cheers!


I don't know if I understood your regex correctly, but you can try a non-greedy solution:

<\?php\n//{{([^*]|[\r\n])*?\?>

Just append ? to the *.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜