Problem with a regular expression in PHP
I need to get this working:
PHP
First match should look for the following:
$pattern1 = "/<div rawurl\=\"(.*)\" class/"; // Add wildcard here as there will be 10 matches, we are only looking for one.
开发者_运维问答 preg_match($pattern1, $file, $out1);
Then run a second check to see if our defined variable exists in the result from the first preg_match
$out1
,
$pattern2 = preg_quote("http://domain.com/extras/?possiblequery" ."/");
$pattern2 = "/".$pattern2."/";
if (preg_match($pattern2, $file, $out));
{ return result
I have trouble coding up the regular expression for these two preg_match
lines... I am pretty sure it's the first one with the wildcard.. Any help is welcome!
You need to specify the delimiters with the second parameter of preg_quote
:
preg_quote("http://example.com/extras/?possiblequery", "/")
As far as I understand, the lack of ’?’ after ’.*’ seems suspect to me.
What do you call a widcard ?
精彩评论