RegexWars
Tier 6 · Adeptreplace

Squash The Gaps

Collapse every run of whitespace down to a single space.

Your first replace challenge: you supply a pattern and a replacement string, and the input is rewritten. Note that replacing only the first run is not enough — the g flag earns its one character here.

Your pattern0 chars · par 5
//
Flags
Start typing — tests run as you go.0 of 5 visible tests passing
Test cases
  • a b→ "a b"
  • hello world again→ "hello world again"
  • tabhere→ "tab here"
  • ··padded··→ " padded "
  • nogaps→ "nogaps"

+ 3 hidden tests, checked when you submit. They are what stops a pattern that only fits the examples above.