Hi all,
I need help in regexp.
I have this statment
$website = 'http://www.sample.com/';
$str = preg_replace("/<A[ \r\n\t]{1}[^>]*HREF[^=]*=[ '\"\n\r\t]*([^ \"'>\r\n\t#]+)[ \"'>\r\n\t#>][^>]*>(.*)<\/a>/isU", '<a href="'.$website.'$1">$2</a>', $str );
where Str is an HTML page code, It make the links with full path.
my problem is it cover all links, what ever it's a full path eg.
<a href="http://www.sample.com/page.html">page</a>
I want to update this regular expression, to make it not change the full path only the small links for example
<a href="page.html">page</a>
make it
<a href="http://www.sample.com/page.html">page</a>
please help. 😕