I want to validate a string if it does not contain a new line.
for Eg: string 1: "adsfasdfasdf" - should say true
string 2: "asdfasdfsd
asdfasdfas" should return false (i don't want string which has a new line)
string 3: "asdf efgh" should say true (string has space needed, need to ignore if it has new line or tab)
my regex - /^\S+$/
// this consider tab along with new line... I tried \N but no help... I want to validate the new line, not tab space.
const regE = new RegExp(/^\S+$/g);
console.log("working", regE.test("Asdfasdf"));
console.log("working", regE.test("asdfasd\n\n\nasdf"));
console.log("not working", regE.test("Asdfasasdfsa dfasdfsdfd"));