fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. Regex regex = new Regex(@"^100(\.0{1,2})?|[0-9]{1,2}(\.[0-9]{1,2})?%$");
  9. foreach (var s in new[] {"100.00%","0%","100%","100.0%","90%", "90.1%", "9.00%", "0.1%"}) {
  10. Match match = regex.Match(s);
  11. Console.WriteLine(match.Success);
  12. }
  13. }
  14. }
Success #stdin #stdout 0.07s 34080KB
stdin
Standard input is empty
stdout
True
True
True
True
True
True
True
True