public Tolerance(string s)
{
Match m = StringRegex.Match(s);
if (!m.Success)
throw new ArgumentException("Input string is not in the correct format: " + s);
Type = m.Groups[1].Success ? ToleranceType.PlusAndMinus : ToleranceType.FullWidth;
Value = double.Parse(m.Groups[2].Value, CultureInfo.CurrentCulture);
ToleranceUnit type;
Enum.TryParse(m.Groups[3].Value, true, out type);
Unit = type;
}