Fix infinite loop in StringExtract