fork download
  1. public class Example
  2. {
  3. public static void Main()
  4. {
  5. Regex rgx = new Regex(@"\d*\.\d?");
  6.  
  7. // Define some test strings.
  8. string[] tests = { "-42", "19.99", "0.001", "100 USD",
  9. ".34", "0.34", "1,052.21", "$10.62",
  10. "+1.43", "-$0.23" };
  11.  
  12. // Check each test string against the regular expression.
  13. foreach (string test in tests)
  14. {
  15. if (rgx.IsMatch(test))
  16. Console.WriteLine("{0} is a currency value.", test);
  17. else
  18. Console.WriteLine("{0} is not a currency value.", test);
  19. }
  20. }
  21. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(5,7): error CS0246: The type or namespace name `Regex' could not be found. Are you missing a using directive or an assembly reference?
Compilation failed: 1 error(s), 0 warnings
stdout
Standard output is empty