can't find name of URL with regex based on URL
Posted: Wed Mar 14, 2012 8:42 am
hi all
can somebody please help me find regex that gets link name of a URL
I need to get only link name
I've tried these but it doesn't return nothing
can somebody please help me find regex that gets link name of a URL
I need to get only link name
I've tried these but it doesn't return nothing
Code: Select all
<?php
$fileContent = file_get_contents("http://www.example.com");
$href = "http://www.this-is-my-url.com/and/my/pages/";
$pattern = "/href=\"$href\"/>(.*)(<)/i";
preg_match_all($patern, $fileContent, $match);
print_r($match);
?>