Limit the maximum length of a reference definition. Use StringPart instead of Substring for reference label parsing.