using System; using System.Text.RegularExpressions; namespace mustache { /// /// Provides utility methods that require regular expressions. /// public static class RegexHelper { /// /// Determines whether the given name is a legal identifier. /// /// The name to check. /// True if the name is a legal identifier; otherwise, false. public static bool IsValidIdentifier(string name) { Regex regex = new Regex(@"^[_\w][_\w\d]*$"); return regex.IsMatch(name); } } }