I have string that has some very long text together with no spaces. How can I search the string for anything over 80 characters long with no spaces and remove it?
looks like preg_replace should work, but I'm not sure what the regular expression would be to find the long text strings....
thanks!
You could try something like:
$str = preg_replace('/\S{80,}/', '', $str);
My idea is to replace any stretch of 80 or more ({80,}) non-whitespace characters (\S) with an empty string.
thanks laserlight......