Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/282.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 正则表达式检索“| Description=”和“| Category”之间的所有内容_Php_Regex - Fatal编程技术网

Php 正则表达式检索“| Description=”和“| Category”之间的所有内容

Php 正则表达式检索“| Description=”和“| Category”之间的所有内容,php,regex,Php,Regex,鉴于以下案文: |Description=This is the start of the ... ... <strong>description</strong> of a product that can span over multiple lines |Category=Product 如何检索| Description=和| Category=Product之间的文本 在上面的示例中,返回字符串应仅包含: This is the start of the .

鉴于以下案文:

|Description=This is the start of the ...

... <strong>description</strong> of a product that can span over multiple lines
|Category=Product
如何检索| Description=和| Category=Product之间的文本

在上面的示例中,返回字符串应仅包含:

This is the start of the ...

... <strong>description</strong> of a product that can span over multiple lines
使用此模式\|Description=..\\\\\\\\\\\\\\\\\\\\\\\\\类别=

使用此模式\|Description=.\\\\\\\\\\\类别=

使用此模式

(?<=\|Description=)(.*)(?=\|Category)
使用点全部和多行标志运行它。

使用此模式

(?<=\|Description=)(.*)(?=\|Category)

使用点全部和多行标志运行它。

谢谢,这是有效的。出于兴趣,为什么preg_会匹配“/?@MichaelP:对不起,我不知道为什么会这样:谢谢,这很有效。出于兴趣,为什么preg_会匹配“/?@MichaelP:对不起,我不知道为什么会这样: