regular expression to remove empty lines after text
Find: ^(?:[\t ]*(?:\r?\n|\r))+ Replace: ""
Source: www.ultraedit.com
regex to check non empty string
/^(?!\s*$).+/
regex to match empty string
/^$/ // match exactly ""
regex empty string
const REGEXP = /^$/; const validate = (text) => { return REGEXP.test(text); } const isEmpty = validate(""); const isNotEmpty = validate("x"); console.log(isEmpty); //true console.log(isNotEmpty); //false
regex for non empty string
^(?!\s*$).+
Source: stackoverflow.com
regex is not empty string
const REGEXP = /^$/; const validate = (text) => { return REGEXP.test(text); } const isNotEmpty = validate("x"); const isEmpty = validate(""); console.log(isNotEmpty); //false console.log(isEmpty); //true