ASCII LF (0a) in STREAM

Is there a way to represent the hex 0a in the target of a STREAM::expression? Everything I try causes the literal “0a” or “\n” to be inserted instead of the representation of LF.

STREAM::expression {@\x0d@\x0a@}

Result of replacement is “\x0a” (5c 78 30 61)

STREAM::expression {@\x0d@\n@}

STREAM::expression {@\r@\n@}

Both of these cause the replacement to be the literal “\n” (5c 6e). Is seems that the search operations handles regex/hex just fine, but the replacement chokes on anything other than ASCII.

Hi Walther,

the fix is rather simple. Don’t use

{

Curly-Braces

}

to allow the

\n

to become substituted… :wink:

STREAM::expression "@\n@\n\n\n@"

Cheers, Kai

In case someone else needs to perform a substitution on something not as simple as “\r” or “\n”… I just came up with this explanation…

With some guidance from DevCentral - An F5 Technical Community and some confusion over when to use decimal or hex, I came up with the following solution

when CLIENT_ACCEPTED {
     Store hex 0a (Decimal of 10) as a binary format 
    set replacement [binary format c* {10}]
    STREAM::expression @\r@$replacement@
    STREAM::enable
}