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

Asked

Viewed 402 times

0

Well, I have a CSS file of over a thousand lines, where for every class listed there, there is a code @external stating the same, example:

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

The fact is that I found out that if I give one @external * at the beginning of the code, it already assimilates all CSS classes and I don’t need to declare one by one.

Well, with the problem solved, now my code has been filled with @external [...] and I would like to give a replace on all these lines with Regular Expression.

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

Points to consider:

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

What I’m trying to do (no, I have no knowledge of regex) is more or less that:

($@external+\w+\(\))

1 answer

1


I don’t know what the eclipse syntax looks like, but a Regex that can solve this problem is as follows (in javascript): ^@external (.+)$

It would marry everything in parentheses (group) until the end of the lines started in @external, simply replace that group.

The Regex in more explained form is below.

http://tinyurl.com/m3vgccs

Browser other questions tagged

You are not signed in. Login or sign up in order to post.