Regex To Match Whitespaces Between Words

A regular expression that can be used to match and delete unnecessary whitespace between words in a string.

/ +/g

Matches:

  • Regex<SPACE>Pattern

Non-matches:

  • RegexPattern<SPACE>
  • <SPACE>RegexPattern

See Also: