Hi everybody.
I'd like to match a string of any character, except for whitespace. Can anybody plz give me a quick hint on this?
Thanks in advance,
Dominique
this should do it:
<? if(preg_match("[^\s]",$string)) { echo "string is ok"; } else { echo "spaces detected"; } ?>
I was afraid it was easy 🙂 preg_match("([\s]]*)/", $string)
does the job for me. Whitespace and the closing square bracket (forgot that one) are not matched but anything else.
Thanks! Dominique