Reputation: 69
I would like to get all matches for any url's that have index.php?route=forum/
in them
Example urls to filter are:
http://test.codetrove.com/index.php?route=forum/forum
http://test.codetrove.com/index.php?route=forum/forum_category&forum_path=2
So i need the match to be true if it contains index.php?route=forum/
the http and domain can be anything like http or https or any domain.
Any idea's?
Upvotes: 0
Views: 1297
Reputation: 75639
One possibility is to use the php strpos
function documented here
$IsMatch = strpos ( $url , "index.php?route=forum/");
Upvotes: 0
Reputation: 4285
Rather than using a baseball bat to bludgeon a spider, take a look at strpos().
$string = "index.php?route=forum/";
if (strpos($url, $string) !== false) {
//we have a match
}
Upvotes: 1
Reputation: 3949
You can use regex :
/index\.php\?route=forum\/.*/
Or with the $_GET variable
if(preg_match('/forum\/.*/', $_GET['route'])) {
echo 'yahoo';
}
Upvotes: 1