using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(['""])((?:\\1|(?:(?!\1)).)*)(\1)|(?<OpenMatch>({))|(?<CloseMatch>(}))";
string input = @"if (!(new[] { ""Command"", ""Click"" }).Any(d => xmlAttribute.Name.Equals(d,
StringComparison.CurrentCultureIgnoreCase))) continue;
if (!baseChain.Name.Contains(':')) return chain;
var checkAnyInherited = baseChain.Name.Split(':').Last().Split(',', ' ').Where(d => !string.IsNullOrEmpty(d)).Select(d => d.Trim()).ToList();
private static IEnumerable<StatementReferenceMaster> GetAllMethodsForClass(string className, int projectId)
{
using (ICodeVortoService codeVortoService = new CodeVortoService())
{
object[] parametersExp =
{
new MySqlParameter(""@delim"", MySqlDbType.VarChar) {Value = "",""},
new MySqlParameter(""@className"", MySqlDbType.VarChar) {Value = className},
new MySqlParameter(""@prjId"", MySqlDbType.Int32) {Value = projectId}
};
var callExtExpandedCode = codeVortoService.StatementReferenceMasterRepository
.ExecuteStoreProcedure<StatementReferenceMaster>(""SpGetAllMethodsForClass"", parametersExp)
.ContinueWith(t => t.Result).Result;
return callExtExpandedCode;
}
}
@""CREATE\s+TABLE""
@""\`(.*?)\`\s+\(""
@""^\`(.*?)\`(.*)""
@""^PRIMARY\s+KEY""
@""(.*)\((.*)\)""
""
""
""
""(""
""-""
""DbScript""
@""CREATE\s+TABLE\s+(\[dbo\].)?(\[)?(\`)?(?<TableName>[a-zA-Z0-9_$]+)(\])?(\`)?""
@""^([\s]+)?(\[|\`)?(?<FieldName>[a-zA-Z0-9_$]+)(\]|\`)?""
""TableName""
@""C:\inetpub\wwwroot\flokapture\ExtractedProjects\LocationServicesSource\Pods.Integration.Services.Location.Model\LocationServiceModel.edmx""
@""^<EntityContainer\s+Name=\""([^\""]*)\""""
@""^<EntityType\s+Name=\""([^\""]*)\""""
@""StoreEntitySet=\""([^\""]*)\""""
@""^<Property\s+""
@""^<EntityType\s+Name=\""([^\""]*)\""|^<Property\s+|^</EntityType>\s+""
""<edmx:Mappings>""
""</EntityType>""
""Done""
""SELECT * FROM EntityAttributes WHERE ProjectId = ""
"" Group by EntityName;""
@""(?<VariableName>[a-z_]+)\s*=\s*new\s+[a-z.0-9]+?""
""\\(\\)|[\\s]*[\\w]+\\s+(?<VariableName>[a-zA-Z0-9$_]+)[\\s]*=[\\s]*""
""."" ";
RegexOptions options = RegexOptions.Multiline;
foreach (Match m in Regex.Matches(input, pattern, options))
{
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