1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | using System; using System.Text.RegularExpressions; public class Test { public static void Main() { string[] data = {"TE33", "FR56", "not", "blahblahAJ00blah"}; foreach(string myString in data) { if(Regex.IsMatch(myString, "^[A-Za-z]{2}[0-9]{2}$")) { Console.WriteLine("{0} matches", myString); } else { Console.WriteLine("{0} doesn't match", myString); } } } } |
-
upload with new input
-
result: Success time: 0.07s memory: 34064 kB returned value: 0
1234
TE33 matches FR56 matches not doesn't match blahblahAJ00blah doesn't match
-
result: Success time: 0.06s memory: 34768 kB returned value: 0
55gg
TE33 matches FR56 matches not doesn't match blahblahAJ00blah doesn't match
-
result: Success time: 0.06s memory: 34768 kB returned value: 0
gg44
TE33 matches FR56 matches not doesn't match blahblahAJ00blah doesn't match
-
result: Success time: 0.07s memory: 34728 kB returned value: 0
erter
TE33 matches FR56 matches not doesn't match blahblahAJ00blah doesn't match
-
result: Success time: 0.06s memory: 34080 kB returned value: 0
44tt
TE33 matches FR56 matches not doesn't match blahblahAJ00blah doesn't match
-
result: Success time: 0.06s memory: 34080 kB returned value: 0
string[] data = {"6785", "hygh", "g6b7t", "blahblahAJ00blah"};TE33 matches FR56 matches not doesn't match blahblahAJ00blah doesn't match
-
result: Success time: 0.06s memory: 34768 kB returned value: 0
string[] data = {"5625", "kjiju", "11not", "blahblahAJ00blah"};TE33 matches FR56 matches not doesn't match blahblahAJ00blah doesn't match
-
result: Success time: 0.06s memory: 34768 kB returned value: 0
string[] data = {"5625", "FR56a", "11not", "blahblahAJ00blah"};TE33 matches FR56 matches not doesn't match blahblahAJ00blah doesn't match
-
result: Success time: 0.06s memory: 37224 kB returned value: 0
string[] data = {"TE331", "FR56a", "11not", "blahblahAJ00blah"};TE33 matches FR56 matches not doesn't match blahblahAJ00blah doesn't match
-
result: Success time: 0.05s memory: 37224 kB returned value: 0
TE33 matches FR56 matches not doesn't match blahblahAJ00blah doesn't match


