Regex to add a hierarchy level in all CSS rules

1

I do not know much about regex (I do not think anyone fully understands this) and I would like to do a regular expression to change a CSS file by putting a hierarchy level (a class called "myClass" for example) in all rules, following way:

Current code

div {
   width: 100%;
   border: 5px solid #F00;
}

.botao-vermelho {
   background: #F00;
}

div .botao-vermelho {
   color: #000;
}

Required code

.minhaClasse div {
   width: 100%;
   border: 5px solid #F00;
}

.minhaClasse .botao-vermelho {
   background: #F00;
}

.minhaClasse div .botao-vermelho {
   color: #000;
}

The css file is quite extensive and it is not feasible to do this at hand

    
asked by anonymous 27.05.2016 / 21:33

1 answer

1

The pattern you are looking for is

(.+) {

Replace with

.minhaClasse  {
    
27.05.2016 / 21:43