Mar 27, 2026 - For details about updated CVE-2025-53521 (BIG-IP APM vulnerability), refer to K000156741.

Forum Discussion

____177053's avatar
Sep 10, 2017

How to count a letter in a string by irules?

We wants to count how many "a" or something else in a string using irules,How can we do that?

 

Thanks a lot!

 

1 Reply

  • JG's avatar
    JG
    Icon for Cumulonimbus rankCumulonimbus

     

    when CLIENT_ACCEPTED {
        set NEEDLE "a"
        set HAYSTACK "ababab"
        set NUMBER [llength [regexp -all -inline (?=$NEEDLE) $HAYSTACK]]
        log local0. "Number of instances of a found: $NUMBER"
    }