conware
09-10-2011, 12:30 PM
Hi guys,
I was wondering if its possible with preg_replace to remove whitespace before and after a comma and limit words in a string to have atleast 3 letters?
this, is, a , test , string ,
Could I change the above string into this:
this, is, a, test, string,
with preg_replace?
My current preg_replace looks like this:
<?php
$string = 'this, is, a , test , string , ';
$string = preg_replace('/[^a-zA-Z0-9\s,]/', '', $string);
?>
Thanks for any help.
I was wondering if its possible with preg_replace to remove whitespace before and after a comma and limit words in a string to have atleast 3 letters?
this, is, a , test , string ,
Could I change the above string into this:
this, is, a, test, string,
with preg_replace?
My current preg_replace looks like this:
<?php
$string = 'this, is, a , test , string , ';
$string = preg_replace('/[^a-zA-Z0-9\s,]/', '', $string);
?>
Thanks for any help.