Like Olaf, I’m not 100% certain what you’re after. I have assumed you want up to 20 characters of the hint text, but not the 'Hint: ’ text at the start of the string. Using $myString.substring(6,20) will return an error if the string is shorter than 20 characters long so you need to allow for shorter hints.
I would use a regular expression to match 0 - 20 characters after the 'Hint: ’
Breaking down the regex:
The parentheses define a substring
?(lt)name(gt) creates a named capture for the substring that we can reference when accessing the Match object.
. specifies any character
{0,20} specifies match the character 0-20 times.
Edit: posted code on Gist because it contains angled brackets.