All I want, is to be able to prepend an ID "#content" to every selector in a css file.
Your comment under sabithpocker's answer tells me that instead of dynamically changing your styles, you are looking to statically modify your CSS. I think this would be easiest with a regular expression:
Breakdown of Regex
([,|\}][\s$]*)- Finds the
,from the previous style followed by whitespace (spaces/tabs:
$). The closing brace\comma keeps the regex from looking inside the body of your style.
[\.#]?- Matches the starting
.in the style name, if it is present.
-?[_a-zA-Z]+- CSS style names can start with an underscore or letters. Also, style names can be prepended by a dash.
[_a-zA-Z0-9-]*- Matches the rest of the style name. This can be omitted, but it might be nice to know the style name of all the styles that were modified.
$1#content $2- The
,) and whitespace is left the way it was found (
$1). It is followed by your inserted text
#content(note the space), which is then followed by the style name (
I tested this in Notepad++ and it works on my stylesheets.