Delete After Comma (Including the Comma – (For the RegEx Folks)!

%MacIPAddress% returns my IP address twice! I only want it once...., why does it do that?
All I'm needing is
I know I could limit it to a number of digits with substring, but if the IP is a different number of digits it will not work.
So I think the 'firmest' solution would be regex, I googled a bit but couldn't get the definitive answer.
Appreciate any help.

For me, %MacIPAddress% works as it should, with just one copy of the address, but while you sort out why your response is different, this'll fix it:

1 Like

Hey Troy,

It does not for me – could you be doing this somewhere in your macro?

What version of macOS?
What version of Keyboard Maestro?


Hey @ccstone hope you are well....
hmm, think it's something else attached? to the cpu, although I don't know what....
and I was not clear, when I run the %MacIPAddress%
I get,

so 103 and 203, don't know!
I did do a work around though....

Ah, so... You have multiple IP Addresses.

If you just need the first one you can get by with this pattern:



1 Like

Chris, it may not be clear to many how to use this RegEx pattern.
So, here it is:

Use the Search and Replace action

SEARCH the Variable or Clipboard with the multiple IP addresses,


nothing (leave it blank)


You probably have both WiFi and ethernet enabled. My token actually returns three addresses (I have a VPN as well.)