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

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

WBOY
Release: 2016-06-13 11:06:44
Original
964 people have browsed it

正则表达式匹配时,如何去掉引号
我在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];

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