ereg_replace help
| From: | Martin Towell | Date: | Tue, 18 Nov 2003 05:37:52 +0000 |
| Subject: | ereg_replace help | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-170055@lists.php.net to get a copy of this message | ||
Hi All,
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 :(
TIA
Martin