Advertisement
Aborigenius

MatchHexadecimal

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