I know people often get told off here for using regexes to fiddle with HTML which I understand but I think in this case I have a valid use for it to alter a CSS file. Unfortunately I am hopeless at writing them myself.
I'm writing a script (PHP) that needs to dynamically add/remove items in a CSS file. As an example the CSS file may have the following declaration:
.cat-item-4 {
background: #ff0fcd;
}
Presumably a regex is possible to remove this whole declaration? It may contain other things asides from "background" so would need to spot the .cat-item-4 class and then remove both that and everything between and including the parentheses. The whole lot basically.
Any help appreciated.