Which regular expression use to replace on all occurrences found in a file in Eclipse?

0

Well, I have a CSS file of more than a thousand lines, where for every class there listed, there is a code @external declaring the same, eg:

@external agora-eu-posso-usar-minha-classe;
.agora-eu-posso-usar-minha-classe{
    /* CSS... */
}

The fact is that I discovered that if I give a @external * at the beginning of the code, it already assimilates all CSS classes and I do not need to declare one by one.

Well, with the problem solved, my code has now become full of @external [...] and I would like to replace all those lines with Regular Expression.

What expression would return everything within @external [...] ; ?

Points to consider:

  • The [...] can contain any valid CSS class name;
  • The [...] can contain several declared classes, eg @external classe-1, classe-2;

What I'm trying (no, I have no knowledge in regex) is more or less this:

($@external+\w+\(\))
    
asked by anonymous 20.03.2014 / 15:56

1 answer

1

I do not know how the eclipse syntax is, but a Regex that can solve this problem is as follows (in javascript): ^@external (.+)$

It would match everything in parentheses (group) to the end of the lines started in @external , with just a replace of that group.

Regex is explained more fully below.

link

    
20.03.2014 / 16:11