using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"CHARGETYPE\s\[(?<CHARGETYPE>[^\]]*)]";
string input = @"2023-04-25 23:15:00.438, BUSINESSIDENTIFIER=""06-02-10112022-85346-L"", MESSAGEIDENTIFIER=""42920d7b-4bde-4a7c-9704-532bc178acfd"", PAYLOAD=""BusinessIdentifier : 06-02-10112022-85346-L ***** MessageIdentifier : 42920d7b-4bde-4a7c-9704-532bc178acfd ***** TimeStamp : 2023-04-25T23:00:48.149+08:00 ***** ElapsedTime : 0.05 ***** InterfaceName : BRM ***** ServiceLayerName : Remedy ***** ServiceLayerOperation : CreateQPBillingEvents ***** ServiceLayerPipeline : ServiceLayerErrorHandler ***** SiteID : AWS ***** DomainName : OSBDomain ***** ServerName : OSBServer ***** FusionErrorCode : ***** FusionErrorMessage : ***** <ns2:createQPBillEventsResponse xmlns:ns2=""com.alcatel.lucent.on.ws.manager""><reason>Insert into tables failed-ORA-00001:Duplicate Check Fail for ORDER_ID[06-02-10112022-85346-L] TROUBLE_TICKET_ID[] CHARGETYPE [RSCN4]</reason><response_Code>-1</response_Code></ns2:createQPBillEventsResponse>"", TIMESTAMP=""2023-04-25 23:00:48.149"", SERVICELAYEROPERATION=""CreateQPBillingEvents"", ELAPSEDTIME=""0.05"", SERVICELAYERPIPELINE=""ServiceLayerErrorHandler"", REASON=""Insert into tables failed-ORA-00001:Duplicate Check Fail for ORDER_ID[06-02-10112022-85346-L] TROUBLE_TICKET_ID[] CHARGETYPE [RSCN4]"", RESPONSECODE=""-1""";
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