Home  >  Article  >  Backend Development  >  正则表达式匹配时,怎么去掉引号

正则表达式匹配时,怎么去掉引号

WBOY
WBOYOriginal
2016-06-13 12:58:242047browse

正则表达式匹配时,如何去掉引号
我在php中运行如下程序
$str = ' 正则表达式匹配时,怎么去掉引号 ';
$soImages = '/\'(.*?)\'/';
preg_match_all( $soImages, $str, $thePics );
$allPics = count($thePics[0]);
if( $allPics > 0 ){
echo $thePics[0][0];
}
?>

返回的结果为'http://xxx/xxx.jpg'
我希望返回结果直接是http://xxx/xxx.jpg
请问如何让正则匹配返回不带单引号的结果?
------解决方案--------------------
echo $thePics[1][0];

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: ecshop开发订餐网解决办法 Next article: zend_acl应用