Since the matched substrings aren't being used in any way, this would be much more efficient as `!/\d/.test(s.charAt(index++))`.