i need help with this regex pattern. I have tried many different patterns but none return anything. I always get an empty array. The following patterns return no results.
//test 1
$regex = '/linkDestUrl = \'(.*)\'/';
//test 2
$regex = '@^(?:\s)*(linkDestUrl = \'(.*)\');@mi';
to match this
linkDestUrl = 'http://www.google.com';
if its that simple, this should work:
$search = "linkDestUrl = 'http://www.google.com';";
preg_match_all("/linkDestUrl = '(.*)';/im", $search, $result);
var_dump($result[1]);
Try it out on http://regex.larsolavtorvik.com/
您可以使用http://gskinner.com/RegExr/之类的网站来测试您的reg exp
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.