Hey guys, I am making an application using C# in Visual Studio that minifies CSS code. Now I came across a piece of code that strips all prefixes for the # ID selector.
strCSS = Regex.Replace(strCSS, @"[a-zA-Z]+#", "#");
However, this would also remove any class names in front the ID selector. For example,
#interior .field#user-comment
{}
when passed through the Regex, will become -
#interior .#user-comment
{}
How do I prevent this from happening? Should I use a ?
condition in the Regex, or a Match
?