using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"Number\:\s(?<Number>\d+)[\r\n]Category\:\s(?<Category>.*).*[\r\n].*[\r\n].*[\r\n]What\sis\sthe\sspecific\srole\sor\sfunction\sof\sthis\sserver\?\:\s(?<Function>.*).*[\r\n].*[\r\n].*[\r\n].*[\r\n].*[\r\n].*[\r\n].*[\r\n].*[\r\n].*[\r\n].*[\r\n]Server\sHostname\:\s(?<Hostname>.*).*[\r\n]Server\sAllegiance\:\s(?<Domain>.*).*[\r\n].*[\r\n]Physical\sLocation\:\s(?<Location>.*).*[\r\n].*[\r\n].*[\r\n].*[\r\n].*[\r\n]Local\sAdministrators\:\s+([\w\s]+)[\r\n].*[\r\n].*[\r\n]Task\sDescription\:\s(?<Task>.*)";
string input = @"Task # 12347859 has been opened and assigned to XXXXXXX - .
Task # 12347859
Client Details
Jackie Newman
servicedesk@thenet.com
Assignment Details
User course@email.com
Status and Priority Details
Urgency: 4-LOW
Impact: 4-MINOR
Status: Assigned
Task Details
Number: 12347859
Category: Add/Upgrade Server Software
Application: Production Web Server
Linked Record: CR123458756 - 2-Implementation
What is the specific role or function of this server?: XXXXXXXXXX
What is the primary application for this server deployment?: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Provide a detailed description that explains the function or role of the server.: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Is this replacing an existing server?: Si
Please explain when will the old server be decommissioned?: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Is this a physical or virtual server?: XXXXXXXXXX
What is the required Operating System?: XXXXXXXX YYYYYYYY ZZZZZZZZ
Patching Schedule: XXX XXX XXX
Environment - Is the server Production, Development or Disaster Recovery?: XXXXXXXX
Server Hostname: XXXXXXXX
Server Allegiance: XXXXXXXX
Will SQL Server be required on this server?: Non
Physical Location: CRPNY – Jackieville, Oregon
Include in Enterprise Backups?: Non
Resource Requirements: RAM: 8 TB
Resource Requirements: CPUs: 16
Resource Requirements: Disk [Quantity and Size(s)]: 2000GB
Local Administrators: Jackie Newman
Richard Jackson
Lewis Asterson
Kyle Lowry
Directories to be excluded from Anti-Virus scanning: XXXXX
Additional Comments:
Task Description: XXXXXX XXXXXX XXXXXX
Date and Time Details
Opened Date: 01/21/2017 3:01 PM Eastern Time";
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