请问一正则表达式

WBOY
Release: 2016-06-13 13:49:23
Original
768 people have browsed it

请教一正则表达式.
{ "user ": "2 ", "sys ":[ "10 ", "11 ", "12 ", "13 "]}

上面的串中,[     ]号内的内容是变数.

我想通过正则截取出     "user ": "2 "     里的2,请问这个正则怎么写.

------解决方案--------------------
读第三个引号和第四个引号之间的内容
------解决方案--------------------
$str = '{ "user ": "2 ", "sys ":[ "10 ", "11 ", "12 ", "13 "]} ';
$e = preg_replace( '/^\{\ "user\ ":\ "(.+?)\ ".*/ ', '$1 ',$str);
echo $e;

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template