\s ، وهي صغيرة s . لا يطابق هذا النمط المسافة البيضاء فحسب ، بل يطابق أيضًا أحرف الإرجاع ، وعلامة التبويب ، وتغذية النموذج ، وأحرف الخطوط الجديدة. يمكنك اعتباره مشابهًا لفئة الأحرف [ \r\t\f\n\v] . let whiteSpace = "Whitespace. Whitespace everywhere!"
اترك spaceRegex = / \ s / g؛
whiteSpace.match (spaceRegex)؛
// عائدات [" "، " "]
countWhiteSpace regex للبحث عن أحرف بيضاء متعددة في سلسلة. \s to match all whitespace characters.");'
  - text: يجب أن يعثر تعبيرك المعتاد على ثماني مساحات في "Men are from Mars and women are from Venus."
    testString: 'assert("Men are from Mars and women are from Venus.".match(countWhiteSpace).length == 8, "Your regex should find eight spaces in "Men are from Mars and women are from Venus."");'
  - text: 'يجب أن يعثر تعبيرك المعتاد على ثلاث مسافات في "Space: the final frontier."'
    testString: 'assert("Space: the final frontier.".match(countWhiteSpace).length == 3, "Your regex should find three spaces in "Space: the final frontier."");'
  - text: يجب ألا يجد "MindYourPersonalSpace" أي مسافات في "MindYourPersonalSpace"
    testString: 'assert("MindYourPersonalSpace".match(countWhiteSpace) == null, "Your regex should find no spaces in "MindYourPersonalSpace"");'
```