private static Shorthand GetShorthand(string value)
{
switch (value)
{
case @"\d":
return Shorthand.Digit;
case @"\D":
return Shorthand.NonDigit;
case @"\w":
return Shorthand.WordCharacter;
case @"\W":
return Shorthand.NonWordCharacter;
case @"\s":
return Shorthand.Whitespace;
case @"\S":
return Shorthand.NonWhitespace;
default:
throw new InvalidOperationException("Invalid shorthand value: " + value);
}
}