Stop writing regexes to lint your code

from blog ankush.dev, | ↗ original
The plural of regex is regrets.The plural of regex is regrets. The problem with regex-based linting tools is fundamentally you are reimplementing language's grammar in hacky manner and you'll inevitably find out edge cases.The problem with regex-based linting tools is fundamentally you are reimplementing language's grammar in hacky manner and you'll inevitably find out edge cases. Take this simple python code as an example.Take this simple python code as an example. def add(a, b): return a + b def add(a, b): return a + b How would you match this code using regexes? Firstly regexes are a pain to work with multiple lines, secondly, python is not a regular language...How would you match this code using regexes? Firstly regexes are a pain to work with multiple lines, secondly, python is not a regular language...