Has snippet of CSS:
.__chat.__32x32 {
color: white;
background: url({ANYNAME:anyName}Images/icons/32x32/chat.png{ANYNAME}) no-repeat;
}
The problem: need to parse out block of css(selector+rules block). Bu closing curly bracket in url considered by my pattern as closing for rules block. All the tries with lookarounds at this point did not give me a success. Question: How to make pattern consider construction {anyname} as part of the match string if it is inside url: rule or rules block?
var parser = new Regex(@"([a-z0-9\s,*\""\[\]=\.\:#_\-@]+){((?>[^}]+|(?:(?<={ROOT)|(?<={VERSION))})*)}|(\/\*(?:(?:(?!\*\/)[\S\s])+)\*\/)", RegexOptions.Multiline | RegexOptions.IgnoreCase);
MatchCollection matches;
matches = parser.Matches(fullContent);
foreach (Match match in matches)
{
if (match.Value.IndexOf("/*") > -1)
{
var cssComment = new CssComment(match.Value);
_cssElements.Add(cssComment);
}
else
{
var cssBlock = new CssBlock(match.Groups[1].Value.Trim(), match.Groups[2].Value.Trim());
_cssElements.Add(cssBlock);
}
}