Search found 5 matches

by shriver
Mon Jul 03, 2006 5:46 pm
Forum: PHP - Code
Topic: Regex help removing multiple commas
Replies: 14
Views: 3286

I see, I wasn't sure if that existed in php. I've mostly used regex in mIRC, and there I would use either \1 or \t (for matched text). I wasn't sure what the equivalent of \t was in php. Thanks for pointing that out.
by shriver
Mon Jul 03, 2006 12:32 pm
Forum: PHP - Code
Topic: Regex help removing multiple commas
Replies: 14
Views: 3286

Ehm, sorry. It was a mistake on my part further up in the script, I had if (preg_match("/([!?.])+/", $message)) and forgot to add the comma to that :oops:

Ignore my forgetfulness, ha.

Thanks anyways.
by shriver
Mon Jul 03, 2006 12:20 pm
Forum: PHP - Code
Topic: Regex help removing multiple commas
Replies: 14
Views: 3286

Sorry to bug again but I just noticed something. It will only remove multiple commas if there also are ! . or ? in the text. If there are only commas then it doesn't remove the extra ones. If I try the same thing with just ! . or ? it will remove them as expected. It's certainly strange behavior. I'...
by shriver
Sun Jul 02, 2006 3:15 pm
Forum: PHP - Code
Topic: Regex help removing multiple commas
Replies: 14
Views: 3286

Thanks you two, the code worked fine.
by shriver
Sun Jul 02, 2006 3:07 am
Forum: PHP - Code
Topic: Regex help removing multiple commas
Replies: 14
Views: 3286

Regex help removing multiple commas

On my forum I have the following few functions that will remove extra ! . or ? and replace them with only 1. $message_array[$x] = preg_replace("/([\!])+/", "\\1", $message_array[$x]); $message_array[$x] = preg_replace("/([\?])+/", "\\1", $message_array[$x]); $...