Regular Expressions 101

Flatten 1 line CSS

Open Workspace
  • PCRE2 (PHP)
  • Substitution
1

Regular Expression

/
\{\n\s+(.+)\n(\s+}|})
/
gm

Description

Finds CSS selectors that only contain one line and, using the substitution, flattens everything to be on the same line.

Submitted by Anonymous