Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript regex check if string is empty

function IsEmptyOrWhiteSpace(str) {
    return (str.match(/^s*$/) || []).length > 0;
}
Comment

regex is empty string javascript

const REGEXP = /^$/;

const validate = (text) => {
    return REGEXP.test(text);
}

const isEmpty = validate("");
const isNotEmpty = validate("x");

console.log(isEmpty); //true
console.log(isNotEmpty); //false
Comment

PREVIOUS NEXT
Code Example
Javascript :: next js Pages with Dynamic Routes 
Javascript :: remove element from array in usestate 
Javascript :: jquery reload iframe 
Javascript :: moment js - to find if dates are same by day 
Javascript :: part of sting js 
Javascript :: json decode list flutter 
Javascript :: discord.js on ready 
Javascript :: install aos angular 10 
Javascript :: js onload 
Javascript :: bootstrap 5.1 3 tooltip not working 
Javascript :: react router redirect 
Javascript :: owl-carousel only for mobile 
Javascript :: momentTimeZone 
Javascript :: get index of item array 
Javascript :: convert elements to array javascript 
Javascript :: uncheck a checkbox in javascript 
Javascript :: eslint-disable-next-line 
Javascript :: how to change style of an element using javascript 
Javascript :: reactive forms change event in angular 
Javascript :: jquery growl cdn 
Javascript :: type of javascript 
Javascript :: what called window.onerror 
Javascript :: lodash remove element from list 
Javascript :: dinosaur game hacks 
Javascript :: bootstrap modal clear all fields 
Javascript :: MongooseError: The `uri` parameter to `openUri()` must be a string, got "undefined". Make sure the first parameter to `mongoose.connect()` or `mongoose.createConnection()` is a string. 
Javascript :: jquery select all checkboxes 
Javascript :: regex for exactly n digits 
Javascript :: js string have number js 
Javascript :: javascript regex replace 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =