Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How would one search, within a CSS file and using Komodo Edit, everything inside and including the brackets from every CSS style rule.

I need to end up with a list of CSS classes and IDs erasing all properties from a very large CSS file.

I need to turn this:

.template{
color: #FFF;
}
.template1{
color:red;
}

into this:

.template
.template1

Thanks in advance.

share|improve this question

you could use a regular expression to find every appearance of things between '{' and '}', and then replace them with "nothing". Note that I don't know Komodo Edit, but I'm guessing it is capable of using regular expressions to search / replace text. Sou you'll have to find out how.

the expression could be like this:

{[\w\s:;#]*}

If you don't know regular expressions, here it is a short explanation:

  • { and } match the { and }
  • [] is the group of characters you will look into the brackets, and here goes whatever you need to select.
  • \w matches leters and numbers, and the underscore
  • \s matches white spaces (spaces, tabs, etc)
  • : ; # - directly matches those symbols

just add any other symbols that you may find between the { }, I may forgot some of them.

However, I highly recommend learning regular expressions, they are a powerful tool to achieve exactly what you need.

A nice playground for regexs can be found here , and over here I've put you the regex I suggest for you to play around with it.

One last word: If you need more help with regular expressions, you could go to stackoverflow instead of here. (perhaps they'll even migrate your post, but I'm answering you here).

good luck!

share|improve this answer
    
Thanx Diego. Your answer has pointed me to the correct direction, but I still cannot select EVERY single block of text within curly brackets. Some are selected, some aren't. I guess I'll need to be much more specific (or not, I'll have to test). – MauF Jan 7 '13 at 22:22
up vote 0 down vote accepted

I fiddled around a bit and with this RegEx pattern:

\{[^\}]*\}

I can select everything I needed, including strings such as:

{
background:url("../img/mas.png") no-repeat scroll center top transparent;height:19px;padding:0;position:relative;width:20px;z-index:98;
}
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .