On Tuesday 18 November 2003 13:37, Martin Towell wrote: > I have an array of strings in the following format: > "abcd - rst" > "abcd - uvw" > "abcd - xyz" > "foobar - rst" > "blah - rst" > "googol - uvw" > > What I want to do is strip everything from the " - " bit of the string to > the end, _but_ only for the strings that don't start with "abcd" > > I was thinking something like the following: > echo ereg_replace("(!abcd) - xyz", "\\1", $str)."\n"; > but obviously this doesn't work, otherwise I wouldn't be emailing the > list... > > Can anyone help? I need to use ereg_replace() because it's part of our code > library and therefore can't change :(
May be quicker (definitely easier) to explode() on ' - '. -- 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 ------------------------------------------ /* The giraffe you thought you offended last week is willing to be nuzzled today. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php