匹配给定字符串内的 WordPress 短代码
我想匹配字符串内的短代码,并从这里找到了以下正则表达式。效果很好。但我想了解它是如何工作的。
谁能解释一下这个正则表达式的组成部分以及它如何匹配短代码。
preg_match_all('%(?<=\[shortcode\]).*?(?=\[/shortcode\])%s',$content, $result, PREG_PATTERN_ORDER);
I wanted to match shortcodes inside a string and found the following regex from here. It works fine. But i want to learn how it works.
Can anyone plz explain me the components of this regex and how it matches the shortcode.
preg_match_all('%(?<=\[shortcode\]).*?(?=\[/shortcode\])%s',$content, $result, PREG_PATTERN_ORDER);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有解释正则表达式的工具。
例如,您的:
阅读有关 http://www.regular-expressions.info/ 上的断言的更多信息Lookaround.html
There are tools to explain regular expressions.
Yours for example:
Read more about the assertions on http://www.regular-expressions.info/lookaround.html