F5 is upgrading its customer support chat feature on My.F5.com. Chat support will be unavailable from 6am-10am PST on 1/20/26. Refer to K000159584 for details.

Forum Discussion

____177053's avatar
Nov 28, 2016

How to use irules to do like this

How to use irules to do like this : We have an ip like:123.12.3.5 How to get the string like:123.12.3

 

Thanks a lot!

 

1 Reply

  • Let us say that you are operating on the client IP:

    set reduced [string range $ip 0 [expr { [string last . [IP::client_addr]] - 1 }]]
    

    This is ~20% faster than a variant:

    set reduced [join [lrange [split [IP::client_addr] .] 0 2] .]