我在 php 中有一个字符串作为
$str = "@113_Miscellaneous_0 = 0@,@104_documentFunction_0 = 1@";
我如何应用正则表达式,以便我可以提取 @ char 之间的字符串,以便生成的结果将是一个数组说
result[0] = "113_Miscellaneous_0 = 0";
result[1] = "104_Miscellaneous_0 = 1";
@Fluffeh 感谢您编辑 @Utkanos - 尝试过这样的事情
$ptn = "@(.*)@";
preg_match($ptn, $str, $matches);
print_r($matches);
output:
Array
(
[0] => \"113_Miscellaneous_0 = 0\",\"104_documentFunction_0 = 1\"
[1] => \"113_Miscellaneous_0 = 0\",\"104_documentFunction_0 = 1\"
)