How to match anything except space and new line?

You can add the space character to your character class to be excluded.

^[^\n ]*$

Regular expression

^              # the beginning of the string
 [^\n ]*       # any character except: '\n' (newline), ' ' (0 or more times)
$              # before an optional \n, and the end of the string

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)