Code: Show/Hide <?php
$text = '<a href="http://www.somelink.com">'; $text = preg_replace( "/<a href=\"(.*?)\">/i", "$1", $text ); echo $text; ?> |
Code: Show/Hide <?php $strHTML = "<HTML><HEAD><TITLE>My site pwns you</TITLE></HEAD> <BODY>This is a link to my site, omg you should click it! <A Target=\"_top\" Href=\"http://www.x2productions.net\" OnMouseOver=\"javascript:SomeFunction()\">MY SITE! CLICK HERE! OMG!</A></BODY></HTML>"; $strHTML = preg_replace("|<A [^>]*HREF=\"(.*?)\"[^>]*>.*?</A>|i", "$1", $strHTML); print $strHTML; ?> |
Quote: |
Replacement may contain references of the form \\n or (since PHP 4.0.4) $n, with the latter form being the preferred one. |