----- Original Message ----- From: "Ford, Mike [LSS]" <[EMAIL PROTECTED]> To: "'Kevin Stone'" <[EMAIL PROTECTED]>; "PHP-General" <[EMAIL PROTECTED]> Sent: Tuesday, July 01, 2003 12:19 PM Subject: RE: [PHP] Reg Ex to search for both Integer and Comma-spaced Integer
> > -----Original Message----- > > From: Kevin Stone [mailto:[EMAIL PROTECTED] > > Sent: 01 July 2003 18:07 > > > > $string = "Mark's average score was 544."; > > preg_match("/average score was ([0-9]+)/", $string, $matches); > > $score = $matches(1); > > > > $string = "Julie's average score was 10,443."; > > preg_match("/average score was ([0-9]+,[0-9]+)/", $string, $matches); > > $score = $matches(1); > > > > How do I combine these two queries so that the reg-ex matches > > both the comma > > spaced integer and regular integer? > > preg_match("/average score was ([0-9]+(,[0-9]+)*)/", $string, $matches); > > should do it. > > Cheers! > > Mike Excelent thinking Mike that's exactly the result I was after. Thanks! - Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php