dar*_*ryl 6 php regex preg-match
/(<pre>|<code>|\[code])(.*)(</pre>|</code>|\[/code])/gi
如果我有以下内容:
<code>foobar</code>
但如果我有这样的换行符:
<code>
Awesome
</code>
Run Code Online (Sandbox Code Playgroud)
它不符合它,我做错了什么?
在PCRE中,"." 不匹配每个字符,它匹配所有不是换行符的东西:
在字符类之外,模式中的点与主题中的任何一个字符匹配,包括非打印字符,但不是(默认情况下)换行符.
(http://www.php.net/manual/en/regexp.reference.dot.php)
尝试使用[\ s\S]之类的东西.