--- id: 587d7db9367417b2b2512ba4 title: Match Non-Whitespace Characters challengeType: 1 forumTopicId: 18210 localeTitle: Совпадение символов без пробелов --- ## Description
Вы узнали о поиске пробельных с помощью \s , со строчной s . Вы также можете искать все, кроме пробелов. Поиск непробельных с помощью \S , который является прописной s . Этот шаблон не будет соответствовать пробелам, возврату каретки, вкладке, фиду формы и новым строковым символам. Вы можете думать, что это похоже на класс символов [^ \r\t\f\n\v] .
let whiteSpace = "Пробел. Пробел везде!"
пусть nonSpaceRegex = / \ S / g;
whiteSpace.match (nonSpaceRegex) .length; // Возвращает 32
## Instructions
Измените регулярное выражение countNonWhiteSpace чтобы искать несколько небелых символов в строке.
## Tests
```yml tests: - text: Your regex should use the global flag. testString: assert(countNonWhiteSpace.global); - text: Your regex should use the shorthand character \S/code> to match all non-whitespace characters. testString: assert(/\\S/.test(countNonWhiteSpace.source)); - text: Your regex should find 35 non-spaces in "Men are from Mars and women are from Venus." testString: assert("Men are from Mars and women are from Venus.".match(countNonWhiteSpace).length == 35); - text: 'Your regex should find 23 non-spaces in "Space: the final frontier."' testString: 'assert("Space: the final frontier.".match(countNonWhiteSpace).length == 23);' - text: Your regex should find 21 non-spaces in "MindYourPersonalSpace" testString: assert("MindYourPersonalSpace".match(countNonWhiteSpace).length == 21); ```
## Challenge Seed
```js let sample = "Whitespace is important in separating words"; let countNonWhiteSpace = /change/; // Change this line let result = sample.match(countNonWhiteSpace); ```
## Solution
```js let sample = "Whitespace is important in separating words"; let countNonWhiteSpace = /\S/g; // Change this line let result = sample.match(countNonWhiteSpace); ```