I found a lot of Regex email validation in SO but I did not find any that will accept an empty string. Is this possible through Regex only? Accepting either empty string or
I prefer /^\s+$|^$/gi to match empty and empty spaces.
/^\s+$|^$/gi
console.log(" ".match(/^\s+$|^$/gi)); console.log("".match(/^\s+$|^$/gi));