I am having problem with some regex expression, I need a regex to check whether the field is blank or not, if blank it should show a message “This field is required”.
I tried this regex but it doesn’t work.
allRules = {"required":{
"regex":"none",
"alertText":"* This field is required",
"alertTextCheckboxMultiple":"* Please select an option",
"alertTextCheckboxe":"* This checkbox is required"},
It somehow only works only on textfield not textarea. Anyone can solve this? Thanks
UPDATE: Also, it must allow special chracters as such , and .
The regex
/^$/matches an empty string. The opposite, to check if a string is non-empty, is/./