using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(?ms)(^NAME.*?)^\s+^\d";
string input = @"SQL*Plus: Release 11.2.0.1.0 Production on Wed Jan 27 13:46:07 2016
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
NAME
--------------------------------------------------------------------------------
Agent-Job Follow Up Missed Group D
Agent-Job Follow Up Missed Group E
Audit Archive
Day BGO - 705 and 705NA - A (2)
Day BGO - ERR Quebec - A
Dispatch Lunch Break Agent (Pre-Agent) - Group D
Helper Job Agent (Amend, Prevent, Lead) Group A
Incomplete Tasks Display Status Cleanup - Group A
Jeopardy Agent (Late EnRoute, OnSite, Complete) Group A
Jeopardy Agent (Late EnRoute, OnSite, Complete) Group B
Lunch Break Report Agent(Post-Agent) - Group A
NAME
--------------------------------------------------------------------------------
MST Validation - Group A
MST Validation - Group C
Unschedule INHS Tasks
Unschedule Jobs with Schedule Update Failure - Group E
15 rows selected.
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options";
RegexOptions options = RegexOptions.Multiline | RegexOptions.Singleline;
Match m = Regex.Match(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