cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1188
Views
0
Helpful
1
Replies

Need colon trimmed from string

ian.m.covington
Level 1
Level 1

I need to trim the colon from a string that is set using a regex action but cannot get it to see the colon. Is there some other way to match the ":"? The end result should be the time without a colon in the middle.

########

event none
action 0.00 cli command "enable"
action 1.00 cli command "show clock"
action 2.00 gets $_cli_result
action 2.01 regexp "[0-9][0-9]:[0-9][0-9]" "$_cli_result" string
action 7.00 string trim "$string" ":"
action 7.05 puts "$_string_result"
action 7.06 puts "$string"
action 8.00 exit

rtrr#event man run clock

13:00
13:00

#########

Thanks,

Ian

1 Reply 1

ian.m.covington
Level 1
Level 1

I came up with a way to get the result I wanted. Here is the solution: 

##########

action 3.00 cli command "do show clock"
action 3.01 gets $_cli_result
action 3.02 regexp "[0-9][0-9]" "$_cli_result" hours
action 3.03 cli command "do show clock"
action 3.04 gets $_cli_result
action 3.05 regexp ":[0-9][0-9]" "$_cli_result" minutes
action 3.06 gets $minutes
action 3.07 regexp "[0-9][0-9]" "$minutes" minutes

#############