> -----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 --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php