/[^\s ]/
Blank letters(\s) and double-byte spaces ( ) other than(^) are included.
– \s is a blank character abbreviation, including single-byte spaces, tabs, and new-line characters.
– The space after \s is full-width space
– Double-byte spaces are treated the same as Kanji, so the are not included in \s.
– Brackets([]) mean one character in parentheses. If there is no [], it will search for chunks of “\s”. If you use ^ outside of [], it means a different meaning.
$value = "富士山 が良く見える"; if (preg_match('/[^\s ]+$/u', $value)){ echo "スペースが含まれています"; } else { echo "スペースが含まれていません"; }
What? Something is not working well.