\.[-]?[_a-zA-Z][_a-zA-Z0-9-]*|[^\0-\177]*\\[0-9a-f]{1,6}(\r\n[ \n\r\t\f])?|\\[^\n\r\f0-9a-f]*I think this is nearly correct and the C# that it is not supposed to work with is:
string css = @"
.class1{
color:pink;
}
.class2{
color:blue;
}";
string patt = @"\.[-]?[_a-zA-Z][_a-zA-Z0-9-]*[^\0-\177]*\\[0-9a-f]{1,6}(\r\n[ \n\r\t\f])?\\[^\n\r\f0-9a-f]*";
string[] arr = Regex.Split(css, patt);
}I tried the above code and it worked as Expected, there is an array entry in arr at the index of each class. Therefore each entry in arr contains the text between the class names.Try Regex.Match if you want to get at the names of the classes. And Check that the | character comes out correctly.
Technorati Tags |
class names [feed], regex [feed], css [feed], split [feed], match [feed], index [feed] |
Related Wikipedia Documents |
Regular expression, Regular expression, Cascading Style Sheets, CSS Zen Garden |
My Related Documents |
C#, .Net Framework: CSS C# Token Reader, C#, .Net Framework: RE: Regex 101 Exercise S2 - Verify a string is a hex number |
Related Amazon Books |
The ZEN of CSS Design: Visual Enlightenment for the Web: View From Amazon UK/View From Amazon USA CSS Pocket Reference: View From Amazon UK/View From Amazon USA Professional CSS: View From Amazon UK/View From Amazon USA Eric Meyer on CSS: View From Amazon UK/View From Amazon USA |
Related Images From Flickr |
[[posterous-content:FgwpptIJBghipdEbhyEl]][[posterous-content:xAnJIAkgxAdsGpkumFiq]][[posterous-content:GgccGEyfFGxghferemyI]][[posterous-content:pfhyniafkGthylnjwzeu]] |