public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{
if (!(value is string))
{
return base.ConvertFrom(context, culture, value);
}
else
{
string pattern = @"^[\[\]\\`_\^\{\|\}a-zA-Z]{1}[\[\]\\`_\^\{\|\}a-zA-Z0-9\-]+$";
Regex regex = new Regex(pattern);
if (!regex.IsMatch(value.ToString()))
{
throw new FormatException(@"Nick names may only contain letters, numbers or one of the special characters below. Names can also not start with a number or hyphen.
test");
}
return value;
}
}