From 7cc007e3067229430d324571b42557dd54c60ba0 Mon Sep 17 00:00:00 2001 From: Mario Kandut Date: Fri, 21 Dec 2018 02:14:29 +0100 Subject: [PATCH] add: content for challenge: match whitespace (#31691) --- .../match-whitespace/index.md | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/guide/english/certifications/javascript-algorithms-and-data-structures/regular-expressions/match-whitespace/index.md b/guide/english/certifications/javascript-algorithms-and-data-structures/regular-expressions/match-whitespace/index.md index 6c6d0fb843..e5f71b04bc 100644 --- a/guide/english/certifications/javascript-algorithms-and-data-structures/regular-expressions/match-whitespace/index.md +++ b/guide/english/certifications/javascript-algorithms-and-data-structures/regular-expressions/match-whitespace/index.md @@ -3,8 +3,22 @@ title: Match Whitespace --- ## Match Whitespace -This is a stub. Help our community expand it. +To finish this challenge, it's necessary to use the __/s__ character class in your regexp pattern. -This quick style guide will help ensure your pull request gets accepted. +__\s__ matches a single white space character. (including space, tab, form feed, line feed and other Unicode spaces. - +For example: +```javascript +/\s\w*/ +// matches " bar" in "foo bar". +``` + +__important:__ Characters are case sensitive in regexp. __\S__ matches a single character other than white space. + + +### Spoiiler Alert: Solution ahead +```javascript +let sample = "Whitespace is important in separating words"; +let countWhiteSpace = /\s/g; // Change this line +let result = sample.match(countWhiteSpace); +```