I have a problem with regular expression, I need a regular expression to read classes names with properties and the same thing with IDs and Tags styling, each match must have one block; class name (or classes names) with their style!
To explain my problem, the regular expression must match the following syntax of styling:
#myId {
margin: 10px 8px 9px 0;
}
.myClass1 {
margin: 10px -8px 9px 0;
padding: 10px 8px 9px 0;
}
-my-tag {
margin-down :-10px;
margin-left: 10px;
margin-right: 10px;
}
-my-tag #my-id{
margin-down :-10px;
margin-left: 10px;
margin-right: 10px;
}
#_myI4D6 {margin:10px;}
.myclass.myclass_too {
}
.myclass .myclass_too {
margin-up:10px;
bac: url "(../../image/p_n-G.png)";
Margin: 10px 0 10PX 10Px;
}
#myID .myclass:first-child my-tag {
margin: 10px;
}
.emptyclass {
}
.classname
tagnam {
padding: 40px 999px ;
}
.className #myid
{
maRgin: 10px 0 10px 10px;
}
the first match must be :
#myId {
margin: 10px 8px 9px 0;
}
On advanced if you can solve the comment problem, maybe class commented like:
/* #myId {
margin: 10px 8px 9px 0;
} */
I don’t need to match it.
Note: I write a program using C#, and please note white spaces problems too (Tabs, newlines and spaces).
It seems like you’re trying to implement CSS parsing in C#. I can’t help you with the regex, but I would strongly suggest you avoid implementing such a thing yourself and use an existing CSS parsing library and save yourself tons of efforts.