RegEx on GPS coordinates seems to fail for some reason?!

I have a macro that performs a regex search in a text to find GPS coordinates.

The macro however DID work with KM 8.0.x, but now I updated to 8.2 and now it does not work. The setting says “notify on failure” but it does not notify anything, and the macro just stops without error code.

I tried to perfom this regex:
GPS-Nord: N ([4-5][0-9])(.)([0-9]{1,2})(.)([0-9]{1,2})(.)([0-9]{1,2})
on a text containing this line:
GPS-Nord: N 49°23’36.63

Obviously it is not the most elegant expression, but I just wanted to “hard code” it to this line.

But the macro does not return a result. I placed some “display text” commands before this regex, so I know it stops at the regex.

Any ideas? Why won’t it work?

The regexp itself seems to work fine: regex101: build, test, and debug regex

What do the options in the Action that invokes it look like?

Please post:

  1. Your entire Macro (image and file)
  2. Real-world sample data (everything the RegEx will be seeing as its source string)

BTW, everywhere you are using [0-9] you can just use \d

Thank you for your replies!

I want to conclude this topic for now, because:

  • The regex is not faulty
  • The problem was identifiable with the Keyboard Maestro error log file
  • I can’t post the entire macro because it is a) huge and b) contains company data and it’s way too much to censor it all out, sorry!

Perhaps you could share the cause and fix of the problem so others may benefit.

Okay, here we go!

The cause of the failure was a DIFFERENT regex that failed to find a certain term.

It is important to note that, apparently (?), Keyboard Maestro macros are stopped entirely if a regex search yields no match.

Wouldn’t it be better if, in case of a failed search, all variables would be passed on as empty strings? Paging @peternlewis

You can actually have it either way. In the Action Gear menu there is an option that you can check/uncheck for "Failure Aborts Macro".

This option is available in most Actions.


Thanks a ton for the clarification.

You never stop learning with apps like KM… :sweat_smile: