Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
Created·2026-03-01 16:22
Updated·2026-03-01 17:35
Flavor·PCRE2 (PHP)

/
\{\n\s+(.+)\n(\s+}|})
/
gm
Open regex in editor

Description

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

Submitted by anonymous