If you haven’t tried ChatGPT to help you with RegEx, give it a shot. It’s great! You can tell ChatGPT precisely what you want, and it does the rest of the thinking for you, saving you a lot of headaches along the way. It’s a great time to be alive. Cheers!
After you get the regex from ChatGPT you can run over to https://regex101.com to test it out on your real world data.
For me ChatGPT is trust but verify
Yea I do that
Why is the topic title “More LLM Spam”?
I have no idea what happened or if someone changed it for me. I fixed it.
Claude (Sonnet 3.7) > all other LLM for coding, in my experience, at the time of writing this.
Most crucially, it doesn't forget something you told it three messages ago, as is quite common with Chat GPT. The Claude app is also a lot better laid out; little things like a persistent copy button regardless of the scroll position within a large code block.
As this is a Keyboard Maestro forum, and this thread seems a bit thin on references to, or questions about, Keyboard Maestro:
-
It's a useful rule of thumb that if you find yourself reaching for a regular expression, then Keyboard Maestro can probably offer you better, quicker, and simpler ways of solving your problem.
-
If you find yourself trying to debug a regular expression of more than about 5 characters in length, then it is almost certainly costing you more human time than it is saving.
A regular expression, especially used in Search and Replace mode, is seldom the simplest way to solve anything, and this forum is full of threads in which users report wasting hours trying to get the original problem to fit the (imagined, "regex") solution.
That's true except for when it's not. Then Regex kicks butt.
I have a different perspective on this. Regex can be a powerful and elegant tool, unfortunately it's also quite inscrutable (for most). Using ChatGPT to generate Regex (this topic's subject) is a way to make what would normally be a laborious task easier.
Both very good points.
I don't think this is the place to discuss AI models at length, but regex has so many applications within KM, and any tool that makes it easier to understand or apply is worthy of some focused discussion on the forum.
If we leave aside the part if brackets for a moment, that's surely a correct observation. As for the part in brackets... Well, to steer this back to the original post, I shall offer just the following thoughts.
If regex is not a tool that one has not even rudimentary experience of, it may indeed not be the best tool to reach for first. Conversely, if one does not have enough experience of alternatives, regex may again be the choice when it should not be!
Therefore it is productive for us users to try to gain experience of various methods that are available to us... but of course, we can't spend time learning everything, so we will all have our default approaches.
In the case of regular expressions, we are fortunate that there are resources on the Web that can be used to gain some understanding of the basics quite quickly, not least the site that @johns mentioned.
How one balances that sort of resource with use of Chat GPT and the like will, I suppose, depend upon an individual's aims and motivations.
RegEx is just a tool. Sometimes the wrong one, sometimes the right -- but you need to know enough about it to know when is which.
Tying into another thread -- you can disable/enable a single KM action with:
...but doing the same for multiple actions is going to be a lot more work, since the menu item changes with the number of actions selected:
...and you'll have to include an explicit action for every potential number.
How much easier with a regex! One action is all you need:
And we shouldn't be surprised that questions requesting help with regex come from people less experienced with regex and so are less able to judge when and when not to use regex...
While not a (knowing) user of LLMs myself (yet, but it's on the list of things to do!) I would think generating regex is a pretty solid use for them since there's a well-defined and relatively simple set of rules plus a metric shedload of scraped data in the LLMs training. And any answer is easy to test empirically, or "decode" in something like regex101.
And perhaps that's a good use of LLMs -- using them to give you a leg up on a problem, getting an answer that (even if it isn't right) you can learn from and iterate on.