|
|
|
| Есть строка
<td class='class'><a href="http://www.test.com/opa/7.html">
<img src=/opa/7.gif width="10" border="2" height="29" alt="описание артинки "></a></td>
<td class='class'>еще текст пробелы там</td>
<td class='class'><a href="http://www.test.com/opa/7.html">Тут текст ссылки </a></td>
|
Из нее функцией preg_match_all надо вытащить Тут текст ссылки и еще вытащить /opa/7.gif | |
|
|
|
|
|
|
|
для: tirei_01
(12.03.2011 в 00:03)
| | Можно поступить следующим образом
<?php
$text = "<td class='class'><a href=\"http://www.test.com/opa/7.html\">
<img src=/opa/7.gif width=\"10\" border=\"2\" height=\"29\" alt=\"описание артинки \"></a></td>
<td class='class'>еще текст пробелы там</td>
<td class='class'><a href=\"http://www.test.com/opa/7.html\">Тут текст ссылки </a></td>";
$pattern = "|<a href=\"http://www.test.com([^>]+)\">([^<]+)</a>|";
preg_match_all($pattern, $text, $out);
unset($out[0]);
echo "<pre>";
print_r($out);
echo "</pre>";
?>
|
| |
|
|
|
|
|
|
|
для: cheops
(12.03.2011 в 09:20)
| |
<?
preg_match("/(?<=href=\")(.*)(?:\")/i",$text,$out);
//$out[1] = http://www.test.com/opa/7.html
preg_match("/.+?\/\/.+?(\/.+)$/",$out[1],$end);
//$end[1] = /opa/7.html
preg_match("/(?<=\>)([^<>]+?)(?=<\/a>)/is",$text,$text_link);
//$text_link[0] = Тут текст ссылки
?>
|
| |
|
|
|