:local long1 123ABC
:local long2 "1.2Mbps-20Mhz/2S"
:log info "Long1 is $long1"
:log info "Long2 is $long2"
:local short1 [:pick $long1 0 3]
:log info "Short1 value is $short1"
:local short2 [:pick $long2 0 3]
:log info "Short2 value is $short2"
Log Print:
nov/26 03:41:58 script,info Long1 is 123ABC
nov/26 03:41:58 script,info Long2 is 1.2Mbps-20Mhz/2S
nov/26 03:41:58 script,info Short1 value is 123
nov/26 03:41:58 script,info Short2 value is 1.2
Yes i know the " : pick " command. but i cant use it i think .
The 123Mbps-20MHz/2S can sometimes be 1.2Mbps-20MHz/2S
i need to strip of the “Mbps-20MHz/2S” , so only 123 or 1.2
maybe it can be done with regular expressions and binary operator ~ , but there is to little info for me to understand in manual
“~” binary operator that matches value against POSIX extended regular expression Print all routes which gateway ends with 202
/ip route print where gateway~"^[0-9 \\.]*202\$"