Text Processingflags: gm

Whitespace-Only Line

Matches lines containing only whitespace (or empty lines).

Try it in RegexPro →

Available in

Pattern

regexengine-agnostic
^\s*$   (flags: 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 patterns

Related concepts