Answer the question
In order to leave comments, you need to log in
How to remove a rule in css regex?
Good day. Can you please tell me how to remove unnamed rules in css with a regular expression?
Example:
{
color: red;
}
/((\n|\s{2,3})\{)(.+?)\}/is
a
{
color: red
}
Answer the question
In order to leave comments, you need to log in
https://regex101.com/r/OFX59Z/7
Here you can change the number of hyphens after the defining selector by duplicating [\w)] with \s added inside the "look-back" group (?<!). And in [\w)] add some more characters to prevent deletion.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question