freeCodeCamp/guide/english/javascript/tutorials/invert-regular-expression-m.../index.md

6 lines
234 B
Markdown
Raw Normal View History

2018-10-12 19:37:13 +00:00
---
title: Invert Regular Expression Matches with JavaScript
---
Use`/\S/gi`; to match everything that isn't a space in the string.
You can invert any match by using the uppercase version of the selector `\s` versus `\S` for example.