using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(.+):\s*TextConst\s*ENU\s*=\s*'(.*)',\s*ENG\s=\s'(.*)';";
string input = @"Regular Expression No.1 --> (.+):\s*TextConst\s*ENU\s*=\s*'(.*)',\s*ENG\s=\s'(.*)';
------------------------------------------------------------------------------------
TxtLineText: TextConst ENU = 'Line %1: ', ENG = 'Line %1: ';
TxtNoLinesToProcess: TextConst ENU = 'There are no lines to process', ENG = 'There are no lines to process';
Regular Expression No.2 --> (.+):\s*TextConst\s*ENU\s*='(.*)'\s*,\s*ENG='(.*)'\s*;
-----------------------------------------------------------------------------------
TxtPurchaseWorksheetNosCode : TextConst ENU='PURCH WKSH',ENG='PURCH WKSH';
TxtPurchaseWorksheetNosDescription : TextConst ENU='Purchase Worksheet',ENG='Purchase Worksheet';
TxtPurchaseWorksheetNosStartingNo : TextConst ENU='PW000001',ENG='PW000001';
TxtSalesWorksheetNosCode : TextConst ENU='SALES WKSH',ENG='SALES WKSH';
TxtSalesWorksheetNosDescription : TextConst ENU='Sales Worksheet',ENG='Sales Worksheet';
TxtSalesWorksheetNosStartingNo : TextConst ENU='SW000001',ENG='SW000001';";
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