using System;
using System.Text.RegularExpressions;
namespace mustache
{
///
/// Provides utility methods that require regular expressions.
///
public static class RegexHelper
{
private const string Key = @"[_\w][_\w\d]*";
internal const string CompoundKey = Key + @"(\." + Key + ")*";
///
/// 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("^" + Key + "$");
return regex.IsMatch(name);
}
}
}