finding the interface that a the default route in on

I am trying to figure out which interface my default route is on, we have multiple routes and we use netwatch to switch if needed.

When I run

:local interface [/ip route get [find dst-address=0.0.0.0/0] gateway-status]; :put $interface

I get this

64.xx.xx.165 reachable wlan3

I am using a syslog and using spaces to split an array when parsing, and the 2 spaces in the results are messing up my script.

Is there a way I can just capture the interface .. aka wlan3 and not the IP and the word reachable.

thanks!!!

This should do the trick:

{
:local gatewayStatus [:tostr [/ip route get [:pick [find dst-address=0.0.0.0/0 active=yes] 0] gateway-status]]
:local i [:find $gatewayStatus " reachable " -1]
:local interface
:if ($i > 1) do={
    :set interface [:pick $gatewayStatus ($i +  11) 255]
}
:put $interface
}

PERFECT!!!
Thanks!