Forum Discussion
Steve_Brown_882
Aug 12, 2011Historic F5 Account
Issue with scan commend?
I am working on what should be a really simple irule, but for some reason I cannot get the scan command to work. I have simplified the entire rule down to the following code to trouble shoot.
...
Colin_Walker_12
Aug 12, 2011Historic F5 Account
Muhammad's got it right, although you'd need one more iteration if you wanted 4 sections. The reason that your %s wasn't working is that it is greedy and eats up everything until the next space, including the "." characters.
From the reference:
"
s
The input field consists of all the characters up to the next white-space character; the characters are copied to the variable."
So in your case, to grab all four sections, you'd want something like:
scan $hh {%[^.].%[^.].%[^.].%[^.]}
tclsh testing:
% set hh sub.host.domain.suf
sub.host.domain.suf
% scan $hh {%[^.].%[^.].%[^.].%[^.]}
sub host domain suf
%
Keep in mind you could replace the last [^.] with a %s in case you end up with more than four chunks.
Colin
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