From 661d10412f3ca829a5018b9f136a79e6f938bb58 Mon Sep 17 00:00:00 2001 From: Kirill Malev Date: Tue, 12 Feb 2019 20:34:52 +0300 Subject: [PATCH] Added solution to remove-whitespace-from-start-and-end.english.md (#35145) * Update remove-whitespace-from-start-and-end.english.md * includes whole solution now --- .../remove-whitespace-from-start-and-end.english.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.english.md index e442a1955f..9d29f0a78a 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.english.md @@ -52,6 +52,8 @@ let result = hello; // Change this line
```js -// solution required +let hello = " Hello, World! "; +let wsRegex = /^(\s+)(.+[^\s])(\s+)$/; +let result = hello.replace(wsRegex, '$2'); ```