When I add a regex to something, I pretty much always also add a bunch of unit test cases for it, and I request the same if I see one in a PR. It's much easier to just see a bunch of test cases that help validate than it, and frankly, half the time when I write my own cases I think of situations that could be better handled.
Human- or GPT-generated doesn't really matter IMHO; it still needs tests.
Interestingly, chatGPT is pretty good at generating test cases for regex. It would be really cool to see that functionality integrated to this tool.
I think this is the biggest part. Automatically generated test cases for regex will make verifying regex way easier.
Even better, when you come across some ridiculous unknown legacy regex you can ask for an explanation of it and for test cases to verify that explanation.
Ironically, it showed us the real future of AI
Turns out, someone during the test phase set up a limit of $1/day usage, and nobody ever changed it. We'd just finally hit that limit.
What I'm saying is, this isn't an AI-only problem, but it's comforting to know it's already impacting AI-backed tools.
I'm pretty sure quite a lot of people's names wouldn't be accepted by that. It helps if you add "even weird and foreign names", but who knows if that's actually enough to capture everything.
It should be required reading before being allowed to write code that'll operate on user profiles, but there's no such thing as a programming license, so this link will have to do.
A regex that worked for all names would be extremely weak. I can’t imagine it being much more than testing valid characters.
lol
id: chatcmpl-6zxdwNH3hW7DuZqnCkx4Ukx9rXiuA token usage: 367 date: 1680225296
What would you say was the query for this?
> [gimuy]{0,5}: This part of the pattern matches optional regex flags that can follow the closing forward slash of the regex pattern. The allowed flags are g (global), i (case-insensitive), m (multiline), u (unicode), and y (sticky). This part of the pattern matches zero to five of these flags, without repetition.
Full response: https://gist.github.com/nicolasff/3bbfb4cb8a514f58e140b887bf...
* https://www.oreilly.com/library/view/regular-expressions-coo...