Name.com: Automate your domain portfolio. Zero API fees. Claim your token.

[PHP] Strip "a href" html code from links

SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
Watch

liam_d

The original NP Emo KidEstablished Member
Impact
25
Hi all i need a good way to strip html hyperlink code from a link and just display the actual address, anyone got a good code to do it?

Thanks!
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Some Regular Expression fun.
Its in php currently, but the pattern should be consistent across most languages.

Code:
$string="<a href='http://www.google.com'>Google</a> is a search engine.\n <br />";
preg_match("/\<a href\='([^']+)'\>([^\<]+)\<\/a\>/", $string, $matches);
echo $matches[1];


Bruce
 
0
Close
Appraise.net

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

NamePros now runs XenForo 2.3
We upgraded the forum software to a new version, XenForo 2.3. Thank you for your patience while the forums were offline. Your posts...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back