Forum Discussion
Barry_Gavenda
Nimbostratus
Jun 24, 2019Variable in a string map
We are using a string map where we are replacing the value found with a variable. Sounds nice, but we can't get it to work. F5 just sends it the $variable (literally). Tried brackets, quotes, ev...
have u tried this solution? didn't it work?
SOL6912: Configuring an HTTP profile to rewrite URLs so that redirects from an HTTP server specify the HTTPS protocol
http://support.f5.com/kb/en-us/solutions/public/6000/900/sol6912.html
- Stanislas_Piro2Mar 30, 2018
Cumulonimbus
Hi,
You can first use string map to replace separators by a dedicated character
set tmp [string map {", TEXT=" "|" ", TEXT2=" "|" ", TEXT3=" "|" } $var ]
Then use split with | as separator.
- crodriguezMar 30, 2018Ret. Employee
How about this? Split at the string ", TXT" first (there's a space between the command the the T) and grab what's to the right of that string. Using your examples, after the first split, you wind up with:
TXT=my Variable Value, with spaces and other characters 2=More Data for Second variable 3=Additional info,
Then, split each substring at "=" and grab everything to the right of that character, giving you:
my Variable Value, with spaces and other characters More Data for Second variable Additional info,
On the very last substring, you may need to remove the last comma. I wasn't sure if the last TXTn= parameter would contain a command at the end or not.