Regex: Write once, read never


Regex: Write once, read never.

My solution:
1. Put the regex in a pure function, with a good name.
2. Write automated tests on the function.

Benefits:
✅ Documents my intent. So, it's easier to understand how the regex is intended to work.
✅ Assures it does what I expect.

View original on X