$type =~ s/\s+/ /g; # Liberal for inputs, strict for outputs. $type =~ s/^\s//; $type =~ s/\s\z//; $type = uc($type); $type =~ / ^ (?: VARCHAR (?: \s* \( \s* [0-9]+ \s* \) )? | CHAR (?: \s* \( \s* [0-9]+ \s* \) )? | ... ) \z /x or die;