JavaScript RegExp Search Method console.log(" word".search(/\S/)); // 2 console.log(" ".search(/\S/)); // -1