Militsa

07. Match Hexadecimal Numbers

Nov 29th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.58 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text.RegularExpressions;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _07.Match_Hexadecimal_Numbers
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var regex = @"\b(?:0x)?[0-9A-F]+\b";
  14.             var input = Console.ReadLine();
  15.             var result = Regex.Matches(input, regex)
  16.                 .Cast<Match>()
  17.                 .Select(a => a.Value)
  18.                 .ToArray();
  19.             Console.WriteLine(string.Join(" ", result));
  20.         }
  21.     }
  22. }
Add Comment
Please, Sign In to add comment