Thread: string trouble
View Single Post
Old 08-02-2002, 01:46 PM   PM User | #3
mordred
Senior Coder


 
Join Date: Jun 2002
Location: frankfurt, german banana republic
Posts: 1,848
Thanks: 0
Thanked 0 Times in 0 Posts
mordred is an unknown quantity at this point
...I can't resist... must... use... Regular Expressions

PHP Code:
$old_text "ert, ert,ert,ert,ert"
$new_text preg_replace('/,(?! )/'', '$old_text);
echo 
$new_text
If you're curious, check out the preg_replace function and the Pattern Syntax for lookahead assertions.
mordred is offline   Reply With Quote