TCL function (regexp and regsub function only don partial)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎09-29-2014 03:57 AM
XOS 15.5.2.9 patch1-5
set var a "12345:54321:7806"
set var x $TCL(regexp -all {([0-9]*):([1-5]{5}):([0-9]{1,4})} $a match s1 s2 s3)
show var
----------------------------------------
Count : 5
----------------------------------------
------------------------------------------------------------------
variableName variableValue
-------------------------------- --------------------------------
a 12345:54321:7806
CLI.SESSION_TYPE telnet
CLI.USER admin
STATUS 0
x 1
Form display i can't get match, s1, s2 and s3 variable
Is this a bug
set var y $TCL(regexp -all {:} $a / s4)
30B-01.10 # show var
----------------------------------------
Count : 6
----------------------------------------
------------------------------------------------------------------
variableName variableValue
-------------------------------- --------------------------------
a 12345:54321:7806
CLI.SESSION_TYPE telnet
CLI.USER admin
STATUS 0
x 1
y 2
------------------------------------------------------------------
Form above show var result why i can get match variable content
is this another bug
if that are bugs please quickly correct ...........
set var a "12345:54321:7806"
set var x $TCL(regexp -all {([0-9]*):([1-5]{5}):([0-9]{1,4})} $a match s1 s2 s3)
show var
----------------------------------------
Count : 5
----------------------------------------
------------------------------------------------------------------
variableName variableValue
-------------------------------- --------------------------------
a 12345:54321:7806
CLI.SESSION_TYPE telnet
CLI.USER admin
STATUS 0
x 1
Form display i can't get match, s1, s2 and s3 variable
Is this a bug
set var y $TCL(regexp -all {:} $a / s4)
30B-01.10 # show var
----------------------------------------
Count : 6
----------------------------------------
------------------------------------------------------------------
variableName variableValue
-------------------------------- --------------------------------
a 12345:54321:7806
CLI.SESSION_TYPE telnet
CLI.USER admin
STATUS 0
x 1
y 2
------------------------------------------------------------------
Form above show var result why i can get match variable content
is this another bug
if that are bugs please quickly correct ...........
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎10-26-2017 01:05 PM
What about using Python instead of CLI scripting?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎10-26-2017 11:28 AM
I was trying this out on what is my current version of firmware 15.6.3.1 and it is definitely true that all you can do with regexp is determine if a string matches a pattern. There are no match variable assignments and regsub will do nothing useful.
This is very disappointing because to work around this, an awful lot of extra and quite complex coding is needed. I am going to load up a recent version of XOS and see if anything has changed.
This is very disappointing because to work around this, an awful lot of extra and quite complex coding is needed. I am going to load up a recent version of XOS and see if anything has changed.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎09-29-2014 10:35 PM
Hey Helpme Thanks for the update. I will check it out but if you think this is a bug then please open up a case with GTAC as that is the only way to get bugs fixed. Thanks P
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎09-29-2014 10:18 PM
From original document that's variable will auto generate, i already test if give that variable initialize but that regexp function will exist same bug....
ena cli scrip
set var a "12345:54321:98765"
set var s1 0
set var s2 0
set var s3 0
set var s0 0
set var x $TCL(regexp -all -- {([\d]{1,5}):([\d]*):([\d]{5})} $a s0 s1 s2 s3)
sh var
----------------------------------------
Count : 9
----------------------------------------
------------------------------------------------------------------
variableName variableValue
-------------------------------- --------------------------------
a 12345:54321:98765
CLI.SESSION_TYPE telnet
CLI.USER admin
s0 0
s1 0
s2 0
s3 0
STATUS 0
x 1
------------------------------------------------------------------
The regsub function always only do the match function but variable will not assign ...
so i think that is a bug.
I use ActiveTCL test that above two command the match variable function will ok.
ena cli scrip
set var a "12345:54321:98765"
set var s1 0
set var s2 0
set var s3 0
set var s0 0
set var x $TCL(regexp -all -- {([\d]{1,5}):([\d]*):([\d]{5})} $a s0 s1 s2 s3)
sh var
----------------------------------------
Count : 9
----------------------------------------
------------------------------------------------------------------
variableName variableValue
-------------------------------- --------------------------------
a 12345:54321:98765
CLI.SESSION_TYPE telnet
CLI.USER admin
s0 0
s1 0
s2 0
s3 0
STATUS 0
x 1
------------------------------------------------------------------
The regsub function always only do the match function but variable will not assign ...
so i think that is a bug.
I use ActiveTCL test that above two command the match variable function will ok.
