Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Regular Expression
/
(--[\w-]+:[\s]*[^;\n}]+)
/
gm
Input 1
New
these should match :root { --externalcolor: red; --samename: orange; --samename: #0f0; --foo: green; --FOO: #0f0; --halfsuccess: orange; /* multiple on one line */ --success: green;--success2: #0f0; /* forget the ; */ --success: green --success2: #0f0 --fred: var(--foo); --barney: var(--foo, test) } :root { /* name options */ --4name: startsWithNumber; --name: startsWithLetter; /* value options */ --startWithLetter: red; --startWithPound: #0f0; --startWithNumber: 20px; --startWithQuoteDouble: "test"; --startWithQuoteSingle: 'test'; --containsUrl: url("http://test.com/foo?a=b&c=d"); --containsPunctuation: -_,.; --containsSpace: "test space"; /* misc conditions*/ --multipleOnOneLine1: green; --multipleOnOneLine2: #0f0; --noSpaceAfterColon:test; --multiSpaceAfterColon: test; --dash-in-name: test; --underscore_in_name: test; } /* minified css */ :root{--almost-black:#222;}html{color:var(--almost-black)}body{color:var(--a
Substitution
these should match :root { --externalcolor: red; --samename: orange; --samename: #0f0; --foo: green; --FOO: #0f0; --halfsuccess: orange; /* multiple on one line */ --success: green;--success2: #0f0; /* forget the ; */ --success: green --success2: #0f0 --fred: var(--foo); --barney: var(--foo, test) } :root { /* name options */ --4name: startsWithNumber; --name: startsWithLetter; /* value options */ --startWithLetter: red; --startWithPound: #0f0; --startWithNumber: 20px; --startWithQuoteDouble: "test"; --startWithQuoteSingle: 'test'; --containsUrl: url("http://test.com/foo?a=b&c=d"); --containsPunctuation: -_,.; --containsSpace: "test space"; /* misc conditions*/ --multipleOnOneLine1: green; --multipleOnOneLine2: #0f0; --noSpaceAfterColon:test; --multiSpaceAfterColon: test; --dash-in-name: test; --underscore_in_name: test; } /* minified css */ :root{--almost-black:#222;}html{color:var(--almost-black)}body{color:var(--a