Text Parsing Question


I would like to set up some filters to remove items from a list of text. For example, culling out words that are ALL CAPS, or removing non-alphabetic characters. Is this possible with keyboard maestro? I found a filter function, but it doesn't seem to do what I'm looking for.


The KM Search and Replace action using RegEx should be able to do what you need.
But you will need to post a real-world example of your source text, and of the desired resultant text, using the Forum Code Block.
Please make sure you provide examples for all of your use cases.

Please read:
Tip: How Do I Get The Best Answer in the Shortest Time?

Hey @cmizle,

Welcome to the forum!   :smile:

JM is on the money.

Keyboard Maestro's search and replace function can handle literal strings with or without case-sensitivity – and regular expressions.

You can also use Execute a Shell Script actions to employ any Unix Executable like Sed, Awk, Perl, Python, Ruby, etcetera.

Or you can use Execute an AppleScript actions if you're AppleScript savvy.

Or you can use Execute a JavaScript For Automation actions if you are JavaScript savvy.


Hi guys! Thanks for the quick reply!! What I'm trying to do right now is replace the first character of a string but ONLY if the string begins with a capital S.

For instance:
SBaltic Sea

should become:
[whatever I want to be here]Baltic Sea

I know I can use the replace macro but i am clueless as to the regex code.

Is that possible?
Thanks again!

Your description is still a little bit ambiguous. I presume that you mean the first character of a line and not a word when your say "string". And that is why Sea is not changed to [whatever I want to be here]ea

Under that assumption the Regex is:
Search for: ^S
Replace with: [whatever I want to be here]

^ at the beginning of a Regex specification means "at the beginning of a line"
S means the character capital S.

Perfect! That's awesome! Thank you so much! Good to know about the ^ character - bet i can find uses for that elsewhere as well.

Thanks again!