PSA: Use Chat-GPT for writing and interpreting regex patterns for your convenience.
With all the strengths and shortcomings of Chat-GPT, I wanted to share one consistent strength I found it has when working with regex.
You can ask it to generate regex patterns for known and custom things.
If you are skeptical it is correct (like me), you can ask it to break down the pattern and inspect why the decisions were made. If I don't understand some fields, I type up a quick test and make sure it covers all edge cases.
And my personal favorite, you can paste a regex and ask it to tell you what it matches to. No more writing regex and forgetting what they are for!
I don't always have the opportunity to use regex when I work and would shy away from it because it can become illegible, but now that it is so easy I find I am slapping it everywhere and I cutting down on logic when sanitizing inputs/data. The bonus is now that I'm using it more, I am becoming less reliant on having it be generated for me.
Theres like a whole class of "Stuff you have to relearn every time you have to use it": XPath, JMESPath, cron, ffmpeg, ImageMagick, PostScript etc.. REGEX might be king of those :p