Advertisement
nikolayneykov

Untitled

Mar 25th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.36 KB | None | 0 0
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. class Program
  5. {
  6.     static void Main(string[] args)
  7.     {
  8.         string text = "Here is a name @George| and an age #18*";
  9.         Regex reg = new Regex(@"@([A-Z][a-z]+)\|.*#(\d+)\*");
  10.  
  11.         Console.WriteLine(reg.Match(text).Groups[1]);
  12.         Console.WriteLine(reg.Match(text).Groups[2]);
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement