Forum Discussion

Ian_Stewart_390's avatar
Ian_Stewart_390
Icon for Nimbostratus rankNimbostratus
May 06, 2005

String Escape Sequence

Are there escape sequences for strings inside iRules?

 

 

For example, I want to search a TCP Payload, after a client makes his inital connection, for the string oi%{@"$.

 

However, iRules seems to recognize the quote marks and the bracket, and throws compile errors. But if I simplify the string to "oi", it works fine.

 

 

when CLIENT_ACCEPTED {

 

TCP::collect 16

 

}

 

 

when CLIENT_DATA {

 

if { [TCP::payload] starts_with "oi" } {

 

pool comm_pool

 

}

 

else {

 

discard

 

}

 

}

 

 

How can I search the payload for the more complex string?

 

 

-Ian

2 Replies

  • Use the backslash "\"

     

     

    when CLIENT_ACCEPTED {

     

    TCP::collect 16

     

    }

     

     

    when CLIENT_DATA {

     

    if { [TCP::payload] eq "oi\%\{\\@\"\$" } {

     

    pool comm_pool

     

    }

     

    else {

     

    discard

     

    }

     

    }