On Thursday 27 March 2003 13:05, Jim wrote: > Could someboy please help me with this simple task (at least I though it > would be simple): > > I need to split a string with two dates in into two datestrings, and there > might be whatever between the dates, e.g. > $datestring = "010101aaaaa020202", or $dateting = " 010101+++++++++020202 > " > > Then I thought that > $date = preg_split("/[\D]+/",trim($datestring)) > whould do the job, but it didn't. > > Why? and how should it be?
I'll leave it to someone else to answer why. Try this: // untested, use at your own risk preg_match_all('/(\d){6}/', $str, $matches); -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* Violence is a sword that has no handle -- you have to hold the blade. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php