Forum Discussion
CraigM_17826
Jan 06, 2012Altocumulus
parsing a datagroup/class
Hi all,
I have this situation. Our iRule for our main website now has a lot of redirects which are based on the URI specified. There are now getting to be quite a few of these and for vari...
CraigM_17826
Jan 06, 2012Altocumulus
Hi Hollio,
Interesting how we can come up with different takes on this :) I got this to work....doesn't seem as elegant as yours though :(
set _ptr [class startsearch Friendly_URLs]
while { [class anymore Friendly_URLs $_ptr] } {
set _data [class nextelement Friendly_URLs $_ptr]
set short_uri [lindex [string tolower $_data] 0]
set redirect_uri [lindex [string tolower $_data] 1]
if { $lc_uri equals $short_uri } {
HTTP::redirect "$redirect_uri"
}
}
Still needs some validation work to ensure the datagroup contains two elements per line, but it does work, just a bit more convoluted than your solution. Actually I aquired this code from some sample code in the sample code area, so I suppose I should blame the original author! :)
Craig
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