var string = "This is a\ntest";
string.match(/^[a-z\s]$/i); // ["This is a\ntest" ]
string.match(/^[a-z \r\n]+$/i); // ["This is a\ntest" ]
You don't even need m
apparently. Maybe you need to double escape your escape characters? It looks like there might be some processing going on there. So:
string.match(/^[a-z \\r\\n]+$/i);
Keep in mind that \s
contains space, newline, carriage return and tab (\t
)