using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"\W+注册单位:\W+注册编号/执业印章号:(\W|\d)+注册专业:\W+有效期:\d+年\d+月\d+日";
string input = @"一级注册建造师
注册单位:
云南移民产业投融资有限公司
注册编号/执业印章号:
云1532018201900531
注册专业:
建筑工程
有效期:
2026年08月23日";
RegexOptions options = RegexOptions.Multiline | RegexOptions.Singleline;
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