Forum Discussion
netadmindetail_
Nimbostratus
Apr 22, 2015Better way to Cleaning UP string variable
Hi all
I must use the destination FQND of a TCP connection. I'm able to collect the TCP payload but I need to compare it with a data-class. But before doing that I need to clean the TCP payloa...
- Apr 22, 2015
How about using scan?
If the variable string is set '9net.tcp://sub.domain.com:12345/abcdefg' or 'sometotherstuff9net.tcp://sub.domain.com:12345/abcdefg/lkjsdflkj/sdfl' etc then try using
scan $string {%*[^/]//%[^:]} fqdn
this results in a new variable $fqdn of 'sub.domain.com'
You can test it out by using the tclsh
% set string "lkasdflkjwe234239net.tcp://sub.domain.com:12345/abcdefg/sdlfkjasf" lkasdflkjwe234239net.tcp://sub.domain.com:12345/abcdefg/sdlfkjasf % puts $string lkasdflkjwe234239net.tcp://sub.domain.com:12345/abcdefg/sdlfkjasf % scan $string {%*[^/]//%[^:]} fqdn 1 % puts $fqdn sub.domain.comCheck out this link: https://devcentral.f5.com/articles/irules-101-18revisiting-the-tcl-scan-command
FYI I'm just starting to play with scan so YMMV.
Sheigh
netadmindetail_
Nimbostratus
Apr 22, 2015and I also the payload FQDN doesn't have the same length each time (different port, different path, different sub by customers)
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects