Genesys Cloud - Main

 View Only

Sign Up

  • 1.  Removing non-digits from a string

    Posted 12-18-2025 15:33

    Hello community, if this is in the wrong spot i apologize in advance as this is my first post. Is there a simple way to remove all non-digits from a string in a bot flow? i.e. Bot: I just sent you a 6 digit verification code, let me know the code when you get it. User: Uh yeah, its 1234 56. I just want 123456 set to the var so i can compare. I was thinking regex but if the person replies "not yet" or "i didn't get it" i would like to compensate for that to, small thought in the back of my head was not to treat any no match as i didn't get it. Any advice in any direction (including where else to post) is greatly appreciated. 


    #Community Questions (Contest, Community, etc.)

    ------------------------------
    Kevin Waller
    Senior Telecommunication Architect
    ------------------------------


  • 2.  RE: Removing non-digits from a string

    Posted 24 days ago

    Hi Kevin,

    Welcome to the community, sorry for the delay in response.

    I think using regex would work. In a Set Variable action (string variable, e.g. NormalizedCode): ReplaceRegex(ToString(Slot.VerificationInput), "[^0-9]", "") and then check if it is 6 digits to match the verification code.  If it is more or less than 6, it could take the failure route of try again/resend.

    Hope this helps, but let us know if you have any more questions



    ------------------------------
    Sam Jillard
    Online Community Manager/Moderator
    Genesys - Employees
    ------------------------------



  • 3.  RE: Removing non-digits from a string

    Posted 24 days ago

    Thanks so much for the reply, cant be mad for free help! Going to give it a try and see if it works for what I need.



    ------------------------------
    Kevin Waller
    Senior Telecommunication Architect
    ------------------------------



  • 4.  RE: Removing non-digits from a string

    Posted 23 days ago

    Hey Sam, Is ReplaceRegex() a function in Genesys? I can't find it under Help > Expressions



    ------------------------------
    Cheers
    Zubair
    ------------------------------



  • 5.  RE: Removing non-digits from a string

    Posted 23 days ago

    Hi Kenvin, i believe this option in Digital Bot Flow is ideal for your needs, as it allows you to filter only by numbers in the bot and then perform the necessary processing.



    ------------------------------
    Alesson Santos
    NA
    ------------------------------