I am using vaadins builtin RegexpValidator to check for valid form fields.I have a description field that can have any charater as long as it’s not empty.Initialy i was using “.+” which pretty much worked but when i converted that field from TextField to TextArea it didn’t match my strings anymore as “.+” doesn’t check for newlines or blank spaces.
I have tried doing “(.|\n|\r)+” but that includes writing a blank space or a newline aswell.
I need only to make sure that i have entered atleast one character it doesn’t matter what.
Normally with regex you can check for blanks with “^\s*$” but vaadins RegexpValidator result must match your string so what i am looking is basicaly the opposite of “^\s*$” ? but including atleast one character? RegexpValidator is really confusing me
If you want to allow a pure whitespace text you can use
\sa whitespace character\Sa non whitespace characterthat would match at least one character and would also match newlines, because they are included in
\sIf you want to have at least one Non-whitespace character you can use
That would check for 0 or more whitespaces at the start of the string (this would cover leading newlines) and it would be successful when it finds the first non whitespace.