Show HN: Regex.ai – AI-powered regular expression generator (regex.ai)
Regex.ai is an AI-powered tool that generates regular expressions. It can accurately generate regular expressions that match specific patterns in text with precision. Whether you're a novice or an expert, Regex.ai's intuitive interface makes it easy to input sample text and generate complex regular expressions quickly and efficiently. Overall, Regex.ai is a game-changer that will save you time and streamline your workflow.
125 comments
[ 3.4 ms ] story [ 100 ms ] threadhttps://blog.codinghorror.com/regular-expressions-now-you-ha...
https://xkcd.com/208/
We tell AI what we want. AI produces a hyper-specific, but barely comprehensible result. We look over the result to make sure it’s all good.
Then execute.
Except... it made ONE ERROR that I just spent two hours tracking down and fixing in my JSON file and now in the Stripe dash. (I coincidentally found the error using ChatGPT lol).
It's probably still faster and less error-prone than I could have done it manually. But it's still error-prone...
It only "knows" what it writes down and if you force it to print the intermediate step it can more accurately get to the final answer.
These models do not "think". This is a fundamental misunderstanding of how they work. It's not AI. It's not even language. It's just text inference.
So it's still fair to say you can ask it to think
I would suggest that a person saying "ask the model to think about" in this context in no way implies that that person is confused about the nature of the model, it is simply a convenient piece of language that helps us to achieve the desired result.
Yes, it does. Assuming GPT "thinks" is shaping public perception and that's already gone much too far.
It looks you just pattern-matched on the word _think_ and replied with a pre-made opinion about how AIs can't think. Ironic...
even though I doubt most production code uses the actual, correct, rfc-compliant regex to match emails (it's a monster), this does nothing to improve the situation...
We will be deploying regex.ai v1.1 on the first week of April , with descriptions and 5x improved performance. Stay tuned!
Or, just write regular expressions?
> ... Regex.ai's intuitive interface makes it easy to input sample text and generate complex regular expressions quickly and efficiently.
See: https://www.ibm.com/topics/overfitting
Inputting the sample text:
And highlighting the first "baz" produced patterns which all had "[A-Z][a-z]*@libertylabs\\.ai" included, assumedly due to the default inclusions.Removing those and highlighting the second "baz" resulted "<Agent B>" as the results in one case.
There is no explanation of any patterns generated. If a person is to use one of the generated patterns and Regex.ai is supposed to "save you time and streamline your workflow", no matter "[w]hether you're a novice or an expert", then some form of verification and/or explanation must exist.
Otherwise, a person must know how to formulate regular expressions in order to determine which, if any, of the presented options are applicable. And if a person knows how to formulate regular expressions, then why would they use Regex.ai?
Well guess what, LLM-generated code is someone else’s code: an amalgamation derived from many peoples’ code. Except those people are ‘helpfully’ “abstracted away” from you by the middleman, so you can’t know their original intents and choices. What’s worse, it’s someone else’s code that will be treated as your code—unlike working with a legacy system that everyone knows was written by some guy, in this case any bugs will be squarely on you.
It's all fun and games until they burn down your house.
> ... I need to understand the intent, the whys behind the choices.
As do I.
And that is something ChatGPT-X (for any given X) cannot provide, regardless of whether or not what is produced is correct. Perhaps with some form of backward chaining[0] a ChatGPT-X someday can explain how it arrived at what was produced works.
But "the why" is the domain of people.
0 - https://en.wikipedia.org/wiki/Backward_chaining
Sign of the times perhaps.
Though I guess it's not much different from the thread trashing Dropbox however many years back.
My comment was in direct response to an overarching concern raised by the implications of incorporating "LLM-generated code." This is relevant here due to the "Show HN" description above, which reads thusly:
If you interpreted my characterization of "... like giving a kid a flamethrower" as being hostile, then I extend my apologies to the OP as I was using this phrase as a literary tool detailed subsequently. I thought the subject expansion of "the other half-dozen like it this past week or so" was sufficient.As to "encouraging curiosity", I point you to feedback I provided to the OP in a reply peer to this one.
It's not hostile but I'm a bit tired of all those projects that sprout around AI.
If it was an open-source project full of bugs, I would understand, and encourage and give solutions to the creator of the project, maybe even create tickets or fix bugs.
But with AI, we are flooded with tons of closed-source frontends to a closed-source backend, and those projects are more than buggy since they confidently give bad solutions. It's not like a "DIY electric car project," it's someone putting pieces of cardboard on a Tesla and pretending it makes it safer or faster.
I'm dumbfounded and I don't know how I am supposed to react to this, I would certainly not release that to anyone since it's antithetical to what I do and believe what software should be.
My view on v1s, prototypes and PoCs regardless of their licensing is that by design they're going to be a mess and have errors, if they don't you waited too long to ship. Maybe these folks should have been a little more honest in their marketing but man if we're going to get into a list of the offenders on that front I think they are way way down on that list.
Overall in my view LLMs are the most disruptive thing to come along since the Web itself. Business model's like Google's are facing a direct challenge from this technology. Why do I want to look at Google's first page full of shitty search ads when I can use a LLM to get an answer immediately? As far as I'm concerned at this stage I would love to see a billion projects from every corner of the world built on top of this technology. Whether they're great or they're crap, the avalanche is the first real opportunity in many years to disrupt some giants.
I guess people are getting tired of too many topics in one narrow space. I come to HN for variety. It does get tiring when every single day I see yet another LLM-based solution attempting to solve a problem I don't think I even have.
Overdose of a certain topic is not good for a general tech forum like this. Everything should be in moderation and all that.
With LLM-generated code, especially ChatGPT-style decoder models, none of that is true. All of the posts and comments I see about it here seem to be anecdotes "it can do all of my job for me" yet asking it to write the simplest code creates several issues on my end.
Personally I think a model geared towards code generation isn't an unsolvable task; the Spider dataset was released some time ago (text to SQL task) and the winning approach there was no fanciness on the model side, but rather to just test all the output queries to ensure it's at least valid SQL. That got a 20%+ boost in accuracy.
I do believe LLM code generators can be used with good results. I just know that for me that way is slower and more painful, because I need to switch between creative mode (when I make stuff) and debugging mode (when I need to figure out how someone else’s stuff works). I find keyboard typing speed is usually not what slows me down the most…
Where did you get that number from? Are you saying that roughly one in a thousand person on Earth, alive today, is using Copilot and ChatGPT to write code on a daily basis?
[0] https://www.bairesdev.com/blog/how-many-software-developers-...
Copilot I could see, since I already use Intellisense, autocomplete, and snippets to great effect. I'd be annoyed if I had to work without them. But in general, knowing what I want the code to do is >90% of the work of writing new code.
I feel there are a few possibilities for why I'm confused:
1. I'm not a very good software engineer, at least in certain respects. Maybe I should have a better understanding of architecture patterns or something I might have learned in a CS degree. Maybe I am hacking everything together and maybe I am already a slow coder.
2. I'm not [being] creative enough as a prompt engineer. I typically can't think of any way that ChatGPT could help me without ingesting my entire repo and figuring out the correct patterns. It could be, however, that there are ways to get the answers I need with better questions.
3. We do completely different kinds of work, and some kinds of coding are better suited for AI assistance than others.
At that point the plane AI better be 100% TRUSTWORTHY cause there's no safe fallback.
Also, consider how to express anchoring and/or grouping preferences in the UI or weighting based on highlight positioning. These are oft used features of regex languages.
\b(foo|bar|baz)\b
\w(foo|bar|baz)\w
\bbaz\b
[fF][oO][oO]|[Bb][Aa][Rr]|[Bb][Aa][Zz]
It only lacks a dice button which randomly selects the "correct" answer.
Try giving it examples where the data provides context cues.
Struck me as funny when we have another thread going about people pasting company data into ChatGPT and here we have a regex AI with an example that looks like it's encouraging you to trust it with helping you regex through your PII, just paste it in the box and highlight what you need lol (not saying that's the intent, just that's what less savvy users may do)
Company site does not inspire much confidence: https://libertylabs.ai/
Light on details, heavy on philosophers, trend setters, idea banks, and radicals that make me worried I'm dealing with opportunists taking swings at monetizing a bunch of .ai domains. Especially the weird cinematic banner.
Ah c'mon. It's a bunch of kids -- which I say with envy not malice -- giving something new a go. Let 'em at it!
The products will speak for themselves. This one, meh, not so much. But we should be encouraging not disparaging.
How did I not know about this! Thank you very much. This solves my biggest gripe with regex.
> my coworkers were happy about it because they could understand the regex and even modify it.
The most important point. Computers might read code efficiently, but if people can't reason about it, that is a recipe for bugs to sneak in.
Writing is easy; reading is hard.
That's why LLMs aren't much help to me -- they just increase my workload by giving me more code to read and review. If I write it myself, I already know what it means, so that saves time and effort.
For me the fastest way is to ask generator to create a valid and not necessarily correct regex, so that I can tweak it. I successfully used gpt for just that recently. It even got the capture groups right.
https://arts.units.it/retrieve/handle/11368/2758954/57751/20...
https://arxiv.org/pdf/1908.03316
https://cs.stanford.edu/~minalee/pdf/gpce2016-alpharegex.pdf
2. Some of the regexes are just.. wrong? I selected individual fields but there's one mangled regex that gives me two fields and the text in between, I didn't ask for that and it's no use.
3. None of the regexes could extract the date I selected (of the form 2023-03-28 05:23:28.844); some of the 'agents' used the literal date, the only one that broken it down into \d's didn't match anything because the DEBUG and INFO were mangled into there.
I'm not really sure how this would be at all useful in its current form?
The only solutions that worked were either "\w+ \w+ \w+..." which does not filter anything and may produce errors with other content, or "(first line|second line|third line)" which could be replaced by a bunch of if statements.
The other solutions were plainly wrong but at least they are honest about it and it's shown in the user interface.
For me it's more than useless and I get faster results with https://regex101.com/.
It uses genetic programming to build the regular expression.
https://regex.ai/ was stuck with /9856|10190|9753|8883/ and confidently emitted /\d{4}/ as an alternative.
https://regex101.com/r/cAaV1z/1 confirms the former.
Edit: I got a message saying there were too many requests. So much for not appearing broken. And I'm not using a VPN or anything so I'd appear as ordinary traffic.
One I familiar with is to match datetime interval, when you need to narrow down log rows for a particular time range.
So I built a tool just for it :) https://github.com/ekiauhce/interval-to-regexp
You have to know reg-ex really well to use this tool safely.
P.S. assuming the poster is scanning the comments, typo in the site title: "aritifical"