Dear Claude: Please don't use regex to parse code
Today, I’d like to register a simple complaint: Dear LLMs: Regex is not for parsing code. Parsers are for parsing code. Why? Nested delimiters. Escaped quotes. Identifiers versus keywords. When even something simple like validating IP addresses proves tricky to get right with a regex, there is very little hope for code. I’ve been burned a few times now, so I’m skeptical of regex-based solutions from LLMs. When I see regexes abused, I will gently direct Claude (or whatever proto-sentient coding assistant I happen to be using) to please for the love of humanity don’t use regexes to parse code. ...