...

View Full Version : Regular Expressions



extremed
12-08-2010, 12:23 PM
Hi

Please someone help me to build pattern to match "Size: 350.085 MB" from below line


Category: TV > Episodes Size: 350.085 MB Added: 2010-12-08 10:45:31



Thanks

poyzn
12-08-2010, 12:42 PM
Hi

Please someone help me to build pattern to match "Size: 350.085 MB" from below line


Category: TV > Episodes Size: 350.085 MB Added: 2010-12-08 10:45:31



Thanks



$string = 'Category: TV > Episodes Size: 350.085 MB Added: 2010-12-08 10:45:31';
preg_match('/[^0-9]([0-9\.]+ MB)/', $string, $match);
echo $match[1];

extremed
12-08-2010, 12:45 PM
Thanks poyzn, you are helpful and fast as always



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum