Ensure the Path String in the Clipboard Starts with “/”

Hey Brian,

Things are often that way with Keyboard Maestro, but the opposite is also pretty common.

Kudos – you did a good job of describing your task and making it easy for people to help you.

Here's how I'd probably approach this job:

RegEx – Ensure a Path String starts with “-” ⇢ Negative Lookahead & Positive Lookahead v1.00.kmmacros (6.5 KB)
Keyboard Maestro Export

Whitespace often slips unannounced into copied text – hence the trim action.

A regex with a negative-lookahead-assertion instead of a more formal IF structure.

@cdthomer – this is a case where I personally would probably use a N.L.A – and the macro also incorporates other techniques discussed in this thread:

RegEx question: how to search for white space repetitions (1 tab and 1 new line)

TMTOWTDI

-Chris

2 Likes