diff --git a/client/src/guide/english/certifications/javascript-algorithms-and-data-structures/regular-expressions/match-non-whitespace-characters/index.md b/client/src/guide/english/certifications/javascript-algorithms-and-data-structures/regular-expressions/match-non-whitespace-characters/index.md index e813f5e018..06962d09bf 100644 --- a/client/src/guide/english/certifications/javascript-algorithms-and-data-structures/regular-expressions/match-non-whitespace-characters/index.md +++ b/client/src/guide/english/certifications/javascript-algorithms-and-data-structures/regular-expressions/match-non-whitespace-characters/index.md @@ -1,10 +1,20 @@ ---- -title: Match Non-Whitespace Characters ---- + ## Match Non-Whitespace Characters -This is a stub. Help our community expand it. - -This quick style guide will help ensure your pull request gets accepted. - + +## Problem: + +We need to change the regex ```countNonWhiteSpace``` to look for multiple non-whitespace characters in a string. + +## Solution: + +```js +let sample = "Whitespace is important in separating words"; +let countNonWhiteSpace = /\S/g; // Change this line +let result = sample.match(countNonWhiteSpace); +``` + +## Explanation: + +We use ```\S```, and this pattern will not match any of: whitespace, carriage return, tab, form feed, and new line characters. So we find all matching non-whitespace characters.