Hi friends.... I have:
<pre>
<?
$txt_buffer = '
<a href=tes.htm>asasa</a>
<a href=http://a1.com>A1</a> <a href="ftp://a2.com">A2</a>
<a href=http://a3.com target="blank">A3</a> <a href="ftp://a4.com" asdas>A4</a>
<a href=
https://a5.com target="blank"><img src="A5"></a> <area href="ftp://a6.com" asdas>A6</a>
';
$txt_buffer = ereg_replace( "[\n\r\t]", "", $txt_buffer );
preg_match_all( '#<\w.?(href|onclick|ondblclick|onchange)=[\'"]?((ht|f)tp?://.?)[\'"]?>(.?)<\/\w>#i', $txt_buffer, $arr_matches );
print_r($arr_matches);
foreach ( $arr_matches[ 2 ] as $str_match ) {
$txt_buffer = preg_replace( '<(\w.?)' . $str_match . '(.*?)>', '\1' . md5( $str_match ) . '\2', $txt_buffer );
}
?>
but my result is:
Array
(
[0] => Array
(
[0] => asasaA1
[1] => A2
[2] => A3
[3] => A4
[4] =>
[5] => A6
)
[1] => Array
(
[0] => href
[1] => href
[2] => href
[3] => href
[4] => href
[5] => href
)
[2] => Array
(
[0] => [url]http://a1.com[/url]
[1] => [url]ftp://a2.com[/url]
[2] => [url]http://a3.com[/url] target="_blank
[3] => ftp://a4.com" asdas
[4] => [url]https://a5.com[/url] target="_blank
[5] => ftp://a6.com" asdas
)
[3] => Array
(
[0] => ht
[1] => f
[2] => ht
[3] => f
[4] => ht
[5] => f
)
[4] => Array
(
[0] => A1
[1] => A2
[2] => A3
[3] => A4
[4] =>
[5] => A6
)
)
If is possible i need in index "2" only url address and not the tag attributes.
If is possible I don't need the indexes 1 and 3.
Thanks for help