PatternRegex

Find repeated spaces

Catch double and triple spaces left behind by copy-paste or old typewriter habits, so prose reads clean instead of gappy.

Last updated

Patterng
 {2,}
Open in Regex Tester & Builder

Matches

  • Hello world
  • Too many spaces

Doesn’t match

  • Single spaced text here
  • Tabs are not spaces

Why it’s written this way

The pattern is a literal space with the {2,} quantifier, so it matches any run of two or more consecutive spaces without caring what surrounds them.

It carries no anchors, so it fires anywhere in the text — mid-sentence, at the start of a line, or between words — which is exactly what you want when hunting formatting noise across a whole document.

Edge cases to know

  • It ignores tabs entirely — a tab used for alignment won't trip this pattern the way a stray double space will.
  • Two spaces inside a code block or a Markdown table, where they can be meaningful, get flagged the same as an accidental double space in prose.

Related in Patterns