fork(11) download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. string[] data = {"TE33", "FR56", "not", "blahblahAJ00blah"};
  9.  
  10. foreach(string myString in data) {
  11. if(Regex.IsMatch(myString, "^[A-Za-z]{2}[0-9]{2}$")) {
  12. Console.WriteLine("{0} matches", myString);
  13. } else {
  14. Console.WriteLine("{0} doesn't match", myString);
  15. }
  16. }
  17. }
  18. }
Success #stdin #stdout 0.05s 37224KB
stdin
Standard input is empty
stdout
TE33 matches
FR56 matches
not doesn't match
blahblahAJ00blah doesn't match