Forum Discussion
APM/TCL question, how to replace the fouth octet in network address which include subnet
I have a variable which I inquiry from AD, the variable is in form of x.x.x.x/255.255.255.0 - I need to replace the fourth octet with "0", normally it is set to .254 I have tried this but it does not work
- regsub -all {<.254/>} expr { [mcget {session.ad.last.attr.wWWHomePage}]} .0/
Any help or suggestion is appreciated
2 Replies
- Kevin_Stewart
Employee
Try this:
set tmp [regsub -all {.254/} [mcget {session.ad.last.attr.wWWHomePage}] .0/]; return $tmp - JRahm
Admin
I haven't messed with expressions too much in APM, so I'm not sure if string map is supported in them, but if it is, string map should work:
% set x 10.10.10.254/255.255.255.0 10.10.10.254/255.255.255.0 % string map ".254 .0" $x 10.10.10.0/255.255.255.0keep in mind this will match any occurrence of .254, so if there is a chance it will show in the 2nd or 3rd octet you'll need to interrogate a little deeper.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com