我一直在努力解决这个问题,但想不出一个正则表达式来完成以下任务:
输入字符串(这是被许多其他 JSON 包围的 JSON 数据):
$string=..."natural_order":"12"...
其中 12 也可以是像“1.2”这样的小数,或者像 1288 或 1.288 这样更大。
所需字符串:
..."natural_order":12...
使用 php preg_replace,到目前为止我已经得到:
preg_replace('/[^natural_order:]+"/', '', $string);
但只返回:
"12"
任何想法都非常感谢!