Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript regex check if string is empty

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

regex for check if string is only empty or whitespace javascript

//empty string or white space
function hasWhiteSpace(value) {
  return /^s*$/.test(value);
}

// empty string or string with white space 
function hasWhiteSpace(value) {
  return /^$|s+/.test(value);
 }
Comment

PREVIOUS NEXT
Code Example
Javascript :: js promisify in browser 
Javascript :: javascript capitalize first letter of each word 
Javascript :: how to convert json result into datatable c# 
Javascript :: add class when element in viewport vanilla javascript 
Javascript :: javascript console group 
Javascript :: make event nodejs 
Javascript :: print placeholder value javascript 
Javascript :: chartjs hide text inside bar 
Javascript :: js read from json 
Javascript :: how to make proptypes either or 
Javascript :: jquery event keycode 
Javascript :: perform database transaction with sequelize 
Javascript :: jquery unfocus 
Javascript :: get url in js 
Javascript :: how to use secondary color in material ui useStyle 
Javascript :: jquery get radio checked value 
Javascript :: js copy span text to clipboard 
Javascript :: javascript style onclick 
Javascript :: 3 letter months javascript array 
Javascript :: hide and show on button click in react js functional component 
Javascript :: javascript round to 1 decimal 
Javascript :: jquery reload iframe 
Javascript :: js populate an empty array of zeros 
Javascript :: history.push with params 
Javascript :: gsap js link 
Javascript :: react native slow performance after load iamges 
Javascript :: last element in javascript 
Javascript :: multiple line string in jquery 
Javascript :: how to find and remove object from array in javascript 
Javascript :: express redirect 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =