i assume regular expression might trick haven't been able come 1 works. have long strings in php need clean up. in cases, appears in stead of single space character , in other caes (etc) appears. i'd replace of single occurence space leave others in place intending can maintained.
any thoughts? presume regular expression used here i've been struggling making 1 for while!
you must use negative lookbehind , negative lookahead ensure don't have other around.
$str = preg_replace('~(?<! ) (?! )~i', ' ', $str); more informations lookarounds here.
Comments
Post a Comment