fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. string s = "MONEY-ID123456:MONEY-PAYetr-1232832938";
  9. Regex regex = new Regex(@"(MONEY-ID(?<moneyId>.*?)\:)?(MONEY-STAT(?<moneyStat>.*?)\:)?(MONEY-PAYetr-)?(?<moneyPaetr>.*?)$"); Match match = regex.Match(s);
  10. if (match.Success)
  11. {
  12. Console.WriteLine("Money ID: " + match.Groups["moneyId"].Value);
  13.  
  14.  
  15. Console.WriteLine("Money Stat: " + match.Groups["moneyStat"].Value);
  16. Console.WriteLine("Money Paetr: " + match.Groups["moneyPaetr"].Value);
  17.  
  18. }
  19.  
  20. Console.WriteLine("hit <enter>");
  21. }
  22. }
Success #stdin #stdout 0.07s 36968KB
stdin
Standard input is empty
stdout
Money ID: 123456
Money Stat: 
Money Paetr: 1232832938
hit <enter>