我对整个正则表达式很陌生,并尝试preg_match_all
在 PHP 中做一个,这是我想要的结果,但问题是它匹配了我真正想要的所有内容......就像这样:
字符串:来自正则表达式的匹配:This is something <code>Some code here</code> and more
来自正则表达式的<code>Some code here</code> and more
想要匹配:<code>Some code here</code>
这是我正在使用的正则表达式:
/<code>(.*)<\/code>/
我认为它与开始和结束/
分隔符有关,但我不完全确定。
任何帮助将不胜感激,谢谢!