You might have been getting stuck on the fact that [ and ] are special characters in RegEx and need to be "escaped" to match their literals. Something like this should do you:
...though you'll have to change Local_theText to whatever your variable holding the email's contents is called.
\[(\d+)\] has been terminated for (.*) on (\d{2}/\d{2}/\d{4})
The RegEx is longer than it needs to be, but it might be best to be overly cautious when dealing with canning notifications!
There's nothing dumb about not being able to spot invisible characters! But it is something you learn to check for after getting caught out bazillion times yourself...
As you get more comfortable with those it becomes easier to stretch and reach for more understanding.
Note that in the first search action I've used the multi-line flag (?m), because I'm not assuming there will be only one line of data from the email.
From there I've broken each task into a separate action.
Pro Tip – always test your regular expressions in a good programming editor like BBEdit, but be aware that most of them don't use strict ICU regex like the macOS and Keyboard Maestro.
BBEdit uses PCRE for instance, and the differences can give newbies headaches.
I used to keep this critter around for testing, and it uses ICU regex:
I can't try out the latest version, because it requires macOS Monterey – but I suspect it's improved, since I last had my hands on it.
Thanks Chris, I am now reading this because I finally have the time to absorb it. I have been taking regex courses to learn some basics. This is very helpful.
Sorry for hijacking the thread, but I have a similar but way simpler question.
I have a string: "100 Coke bottles"
Can I split it up and perform a calculation on "100" (for example *2) and then paste the answer as "200 Coke bottles"?
Just to be clear, the "text" portion of the input can and will vary. So I want to extract that and "print" it after the calculation. So it would look something like this:
I bet. I was just showing you another way. It was based on your example so your goalpost moved. You can use a prompt for user input to gather values as well.