regex check whitespace code example
Example 1: regex only letters not spaces
var re = /^[A-Za-z]+$/;
Example 2: whitespace regex
\s is the regex character for whitespace. It matches spaces, new lines, carriage returns, and tabs.
var re = /^[A-Za-z]+$/;
\s is the regex character for whitespace. It matches spaces, new lines, carriage returns, and tabs.