Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/20.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 Regex选择两个字符之间的所有内容_Php_Regex - Fatal编程技术网

Php Regex选择两个字符之间的所有内容

Php Regex选择两个字符之间的所有内容,php,regex,Php,Regex,我需要创建一个正则表达式来选择两个字符(&-@)之间的数据 我想选择foo 有什么想法吗?很好的解释也很感谢。这方面如何: preg_match(“~&([^@]*)@~”,$content,$match)也许你想要^&.@$谢谢你,伙计!工作起来很有魅力。 & foo @

我需要创建一个正则表达式来选择两个字符(&-@)之间的数据

我想选择foo

有什么想法吗?很好的解释也很感谢。

这方面如何:


preg_match(“~&([^@]*)@~”,$content,$match)

也许你想要
^&.@$
谢谢你,伙计!工作起来很有魅力。
& foo @