Hello Subhajit,
The behavior you're seeing is due to how the bot flow processes input versus how the NLU testing works. The bot is actually performing a "sanitization" of the input before storing it, which is why you see the special characters removed in the Set Participant Data action. However, this happens after the validation step. This is why you are seeing the special characters.
I can think you can get around this if you "Ask for Slot" action, add an additional validation step. Configure the "Validation" section of the Ask for Slot action. Set up a custom validation expression that matches your regrex pattern. Then configure the error message to be shown when the validation fails.
To be specific to your issue:
Enable input validation > Set the validation pattern to match your regex: ^[a-zA-Z0-9]{1,17}$ > configure your "No Match" message > set "Retry on Failure" to Yes.
Make sure the flow branches based on the validation result:
Success: Continue to your next step
Failure: Return to asking for input.
Hope this helps!
------------------------------
Cameron
Online Community Manager/Moderator
------------------------------
Original Message:
Sent: 07-08-2025 15:46
From: Subhajit Podder
Subject: Regex slot type in digital bot is not validating customer input data properly
I have created a digital bot where customer name will be taken as input with slot type Regular Expression to specify below patterns.
- Minimum length will be 1 and maximum length will be 17 characters
- Only alphabets and numbers are allowed
- No special characters are allowed
I have created the slot type with the regex pattern as ^[a-zA-Z0-9]{1,17}$ . When I am doing NLU test in slot type window, it is validating the scenarios. But when I'm using it with "Ask for Slot" action in bot, it is accepting all the input with special characters and not throwing any "No Match" message configured in the action. Surprisingly when printing the value with set participant data it is only showing the name without special characters.
I don't want this behavior, rather I want to through the "No Match" message and does not allow user to go next step. Please suggest your valuable input to achieve the use case and correct me if I am doing any mistake.
Added some screenshot for reference. 1. NLU Test not accepting incorrect input pattern, 2.Bot flow to get name and 3. Behavior in bot - Not throwing an error message
#ConversationalAI(Bots,AgentAssist,etc.)
#DigitalChannels
#Implementation
#PlatformAdministration
------------------------------
Subhajit Podder
NA
------------------------------