Forum Discussion
Christopher_J_B
Nimbostratus
Sep 22, 2010Attempting to remove newline/spaces from a HTTP:payload without sucess
I have an irule that parses http payload that contain xml using the findstr function; the problem is some vendors xml requests have spaces and/or newline characters which getting difficult to account for. I am attempting to perform a string map - replacing spaces and newline chars with empty space. I keep getting errors and I cannot seem to get to save without errors.
Here is the actual line - attempting to replace all newline & spaces with empty from the HTTP:payload - while capturing string into the variable
set tmp [findstr [string map [" " "" "\n" ""][HTTP::payload]] "<" 16 ":"]
Here are the errors for the above line
line 32: [wrong args] [string map [" " "" "\n" ""][HTTP::payload]]
line 32: [undefined procedure: ] [" " "" "\n" ""]
I tried this variation - no joy
set tmp [findstr [string map [list " " "" "\n" ""][HTTP::payload]] "<" 16 ":"]
Got this error
line 32: [wrong args] [string map [list " " "" "\n" ""][HTTP::payload]]
Any suggestions?
- hoolio
Cirrostratus
Hi Christopher, - Joel_Moses
Nimbostratus
Hi Chris! - hoolio
Cirrostratus
I think wrapping the find/replace token in square braces won't work as the square brackets act like backticks in *nix and mean the string within is executed as a command. - Joel_Moses
Nimbostratus
Hoolio, that's true enough. It's interesting, though, that tclsh will let you do it without issues -- I guess converting the brackets to act like curly-braces if there's no actual command/procedure to execute inside it? Not that it's the BigIP parser's fault, really... just an interesting difference in behavior between it and tclsh. - hoolio
Cirrostratus
I think the use of square braces is the same in TCL and iRules. With tclsh, this doesn't work: - Joel_Moses
Nimbostratus
You're right; teaches me not to use tclsh under Cygwin. :> - Christopher_J_B
Nimbostratus
Here is the versionVersion BIG-IP 9.4.8 Build 396.1 Hotfix HF3
- Christopher_J_B
Nimbostratus
I have a window tonight - I will test with the curly braces {} - thanks for the help - Christopher_J_B
Nimbostratus
Thanks for the assist - this was correct ->
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