I looking for this but i can't found a good solution.
I found a solution but visual studio get an error
var regexItem = new Regex(@"^[a-zA-Z0-9\_]+$);
And it's my condition:
if (regexItem.IsMatch(name))
{
     //...
}
I looking for this but i can't found a good solution.
I found a solution but visual studio get an error
var regexItem = new Regex(@"^[a-zA-Z0-9\_]+$);
And it's my condition:
if (regexItem.IsMatch(name))
{
     //...
}
 
    
    Just include the pattern for dash and point inside the character class. And it's safe to put - at the last or at the first inside the character class.
new Regex(@"^[a-zA-Z0-9_.-]+$");
