I am new to KM and and have already found it extremelly useful to change some xml code but have come across something that is more advanced and I have no idea how to create an action to sort it!
Is there anyway that KM can find a word in a string and copy that word to another place in the string?
Thank you for your help, yes it will work but because the string changes every time it will only work with this scenario. So the ath="150.712" can be any number at all so searching for a specific string will not work with anything else.
The search scheme in the Regular Expression doesn't reference that data. It works regardless of the specific data, looking just at the name and linkedscene tags. Throw a different line in the Text box to confirm.
Ah, I see now. I seriously need to up my coding skills! I have tried loads of different combinations and they all work, thank you very much for your help.
Brilliant, I had no idea about regular expressions! I will take some time and learn them as I can see that they will actually save me a ton of time when I know how to use them as I am already thinking of numerous ways they will save me time...
Although BBEdit is a commercial product, the trial version reverts to a
still very powerful and free (BBEdit-Lite) version after 30 days.
It is very Mac-like.
It has excellent support for RegEx.
Including a regex-playgound in the commercial version.
It is very AppleScriptable.
It has a two versatile command line tools.
It has been in continuous development for over 25 years.
The only downside to BBEdit for learning regex to use with Keyboard Maestro is that it uses PCRE regex whereas KM uses ICU regex.
The fact that there are different “flavors” of regular expressions is confusing to most users at least at first.
A useful alternative to BBEdit is CotEditor. It's free and uses ICU regex, although it's not nearly as powerful as BBEdit (even the free lite version).
Regular Expressions are enormously useful, and I find them quite fun (like puzzles).
I would add to that: regex101.com is my go-to for creating and testing regular expressions. It tells you if something's wrong, and gives an explanation of how each part of the regular expression works. And it's free.