| Posted by Toby A Inkster on 03/28/07 10:23 
iktorn wrote:
 > <?php
 > $text ="sajdkahs (2005) asgjgdjasdkh (20056) hdsgfjsgfsd
 > ajgsda (1234 jksdhkjfhskjdh ) sgfdggsd (1256)";
 > if(preg_match_all("/\([0-9]{4}\)/",$text,$matches)) {
 >      print_r($matches[0]);
 > }
 > ?>
 
 Better:
 
 <?php
 $text ="sajdkahs (2005) asgjgdjasdkh (20056) hdsgfjsgfsd
 ajgsda (1234 jksdhkjfhskjdh ) sgfdggsd (1256) 2345";
 if(preg_match_all("/\(([0-9]{4})\)/",$text,$matches)) {
 print_r($matches[1]);
 }
 ?>
 
 --
 Toby A Inkster BSc (Hons) ARCS
 Contact Me ~ http://tobyinkster.co.uk/contact
 Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux
 
 * = I'm getting there!
 [Back to original message] |