public static Picture Parse(string text) {
var match = Regex.Match(text, PARSE_PATTERN);
if (match != null) {
var kind = match.Groups[1].Value == "X" ? PictureKind.Alphanumeric : PictureKind.Numeric;
var length = byte.Parse(match.Groups[2].Value);
byte decimalLength = 0;
if (kind == PictureKind.Numeric && !string.IsNullOrWhiteSpace(match.Groups[3].Value)) {
decimalLength = byte.Parse(match.Groups[4].Value);
}
return new Picture(length, decimalLength, kind);
} else {
return new Picture();
}
}