Link Search Menu Expand Document

Match Non-Whitespace Characters

Summary

  • \S is used to search for non-whitespace.

Final Code

let sample = "Whitespace is important in separating words";
let countNonWhiteSpace = /\S/gi; // Change this line
let result = sample.match(countNonWhiteSpace);