On Monday 17 November 2003 23:37,
Martin Towell <[EMAIL PROTECTED]> sent a missive stating:
> 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
Possibly have to do a if statement, ereg for the abcd and then if ture, do
your ereg replace? I can't logically think how that would work in one regex,
since you want to match first and then replace...but my regex skills aren't
top notch either :)
Henrik
--
Henrik Hudson
[EMAIL PROTECTED]
"`If there's anything more important than my ego
around, I want it caught and shot now.'"
--Hitchhikers Guide to the Galaxy
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php