Forum Moderators: coopster
$string = "A generous Memory 4GB ensures multitasking isn't a problem while the 300GB Hard Drive provides you with vast amounts of storage space for all your multimedia files...";
if(preg_match("/([0-9]{3}GB Hard Drive)/", $string, $result)){
echo "Matched<br />";
echo $result[1];
}
else{
echo "Not Matched";
}
/([0-9]{3})\s*GB/i if(preg_match('/([0-9]{1,3}[GT]B Hard Drive)/im', $string, $result)){
As "GB" is fairly commonly used, I suspect it is possible to pick it up out of the context of hard drives, so I would say the words "Hard Drive" is required.
/([0-9]{1,3}\s*[GT]B) Hard Drive/im