Ask for a regular expression try!! Urgent, urgent and urgent! 100-minute Belt
A connection similar to this one:
href= "Http://url" target= "_blank" > title
or a
href= "Http://url" > title
Wait for such a connection:
I need to use Preg_match_all to get a URL and a caption. Array.
Wait in the belt. I want to enlighten you. Give points immediately
------Solution--------------------
#]+href= ([' \ "]?) (. +) \\1[^>]*> (. *) <\/a> #isU
------Solution--------------------
Preg_match_all ('/]+href[\s\r\n]*=[\s\r\n]* ([' \ ']?) (. +) \1[^>]*> (. +) <\/a>/isu ', $text, $matches);
------Solution--------------------
@href = "(. *)" .*> (. *) <[email protected]
Example:
$str = < <
href= "Http://url" target= "_blank" > title
or a
href= "Http://url" > title
EOF;
Preg_match_all ("@href =\" (. *) \ ".*> (. *) <[email protected]", $STR, $matches);
Print_r ('
');
Print_r ($matches);
?>
Output:
Array
(
[0] = = Array
(
[0] = href= "http:// url "target=" _blank "> title"!--
[1] = href= "Http://url" > title!--
)
[1] = = Array
(
[0] = = Http://url
[1] =/http URL
)
[2] = = Array
(
[0] + = title
[1] => ; Title
)
)