[PHP] Re: preg_replace() help

2007-07-14 Thread Al
What do you want out? $txt = 'A promise is a debt. -- Irish Proverb'; => [1] $txt = 'A promise is a debt. --Irish Proverb'; OR [2] $txt = 'A promise is a debt. --IrishProverb'; for [1] $txt= preg_replace("%--\x20+%", '--', $txt); //The \x20+ is one or more spaces Rick Pasotto wrote: I hav

[PHP] Re: preg_replace help

2002-01-12 Thread Gaylen Fraley
First of all, thanks to everyone who replied! I have several good suggestions. Here is one that seems to work pretty well, to cover a multitude of situations: $msg = eregi_replace("([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])","\\1://\\2\\3", $msg); The only problem is that if a correct