Text Processingflags: gm

Whitespace-Only Line

Matches lines containing only whitespace (or empty lines).

Try it in RegexPro

Pattern

regexJavaScript
/^\s*$/gm

Raw source: ^\s*$

How it works

`^\s*$` anchors to a full line that contains zero or more whitespace characters and nothing else.

Examples

Input

line one line two

Matches

Common use cases

  • Whitespace cleanup
  • Linters
  • Blank-line detection

Related concepts