Regular Expression for alphanumeric and underscores
To match a string that contains only those characters (or an empty string), try This works for .NET regular expressions, and probably a lot of other languages as well. Breaking it down: If you don’t want to allow empty strings, use + instead of *. As others have pointed out, some regex languages have a shorthand form … Read more