This is the text:
<tr>
<td class="ttl"><a href="glossary.php3?term=dynamic-memory">Internal</a></td>
<td class="nfo">16 GB, 1 GB RAM</td>
</tr>
How can I find 16 GB, 1 GB RAM
from text using preg_match?
This is the text:
<tr>
<td class="ttl"><a href="glossary.php3?term=dynamic-memory">Internal</a></td>
<td class="nfo">16 GB, 1 GB RAM</td>
</tr>
How can I find 16 GB, 1 GB RAM
from text using preg_match?
Simply you can do this like this:
$str = '<tr>
<td class="ttl"><a href="glossary.php3?term=dynamic-memory">Internal</a></td>
<td class="nfo">16 GB, 1 GB RAM</td>
</tr>';
preg_match('/\<td class="nfo"\>(.+?)\<\/td\>/', $str, $matches);
print_r($matches);
result:
Array
(
[0] => <td class="nfo">16 GB, 1 GB RAM</td>
[1] => 16 GB, 1 GB RAM
)
$pattern = "/<td class=\"nfo\">(.*?)<\/td>/s";
preg_match($pattern, $stringtomatch, $matches);
echo $matches[1];
Result
16 GB, 1 GB RAM