As far as regexes, The Sed and Awk book is good, but Mastering Regular Expressions by Friedl is amazing. The amount of time that went into that work is mind-boggling. The deep dives into the differences between different engines and the detailed explanations of why one regex performs horribly vs. another that matches the same thing quickly are really enlightening.