.NET Fiddle

CSharp · Console

/Program.cs

using System;
using System.Linq;
using System.Text.RegularExpressions;
public class Program
{
	public static void Main()
	{
		Regex r = new Regex(@"^[A-Z0-9]*$");
		
		string[] ss = new string[] {"Hello", "HELLO", "Hello 123", "HELLO 123", "HELLO123", ""};
		foreach(var s in ss) {
			Console.WriteLine("{0}\t{1}", s, r.IsMatch(s));
		}
	}
}
;