using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"\:(\s)?(.+)[^\{](\v)";
string input = @"#main h1 {
color: #333;
}
a {
text-decoration: none;
color: #333;
}
a:hover {
text-decoration: underline;
}
body {
margin: 0;
display: table-row;
/*vertical-align: middle;
filter: url(#blur);
background: url('bg.jpg') center top no-repeat #333;
background-clip: cover;
-moz-filter: blur(20px);*/
position: relative;
}
body::before {
content:'';
background: url('bg.jpg') center top no-repeat #333;
background-clip:cover;
background-attachment: fixed;
position: absolute;
top: 0; bottom: 0; left: 0; right: 0;
height: 100%;
width: 100%;
filter: url(#blur);
filter: blur(2px);
-webkit-filter: blur(2px);
z-index: -1;
}";
foreach (Match m in Regex.Matches(input, pattern))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx