Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

get the href in string regex php

$html = 'some text here<a href="http://www.mydomain.com/page.html">URL</a> some text here as well';

$url = preg_match('/<a href="(.+)">/', $html, $match);

$info = parse_url($match[1]);

echo $info['scheme'].'://'.$info['host'];
 
PREVIOUS NEXT
Tagged: #href #string #regex #php
ADD COMMENT
Topic
Name
5+3 =