Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Text.RegularExpressions;
  7.  
  8. namespace _8.Match_Numbers
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14. string numbers = Console.ReadLine();
  15. Regex regex =new Regex(@"(^|(?<=\s))-?\d+(\.\d+)?($|(?=\s))");
  16. MatchCollection collection = regex.Matches(numbers);
  17. foreach (var item in collection)
  18. {
  19. Console.Write("{0} ",item );
  20. }
  21. Console.WriteLine();
  22. }
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement