using System;
using System.Text.RegularExpressions;
using static System.Console;
public class Program
{
public static void Main()
string str = "palavra 1-2-5";
Regex rgx = new Regex(@"^[a-zA-Z0-9-]+$");
bool isValid = rgx.IsMatch(str);
WriteLine(isValid);
//Para verificar se a string é uma Guid
Guid result;
bool isGuid = Guid.TryParse(str, out result);
WriteLine(isGuid);
}