handle regexes correctly in formatting

`child` should be passed as an argument to `readTokenInfo` instead of `node`