using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"\[buyer_(?:email|mobile|fullname|address)\] =>\s*\K.*";
string input = @"SimpleXMLElement Object
(
[error_code] => 00
[token] => 1182263526325de72aw828369e7aa
[description] => SimpleXMLElement Object
(
)
[transaction_status] => 00
[receiver_email] => myemail@gmail.com
[order_code] => 3212423
[total_amount] => 200
[payment_method] => SimpleXMLElement Object
(
)
[bank_code] => NLAZ
[payment_type] => 1
[order_description] => SimpleXMLElement Object
(
)
[tax_amount] => 0
[discount_amount] => 0
[fee_shipping] => 0
[return_url] => success.php
[cancel_url] => order.php
[buyer_fullname] => eric phuong
[buyer_email] => eric@domain.com
[buyer_mobile] => 012108609
[buyer_address] => abc
[affiliate_code] => SimpleXMLElement Object
(
)
[transaction_id] => 12345
)";
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