Home  >  Article  >  Backend Development  >  请问一正则表达式

请问一正则表达式

WBOY
WBOYOriginal
2016-06-13 10:05:25787browse

请教一正则表达式.
{ "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;

Statement:
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
Previous article:drupal有关问题Next article:OA系统和域整合解决思路