I want to restrict some special characters only in my input field.Apart from using javascript to block, is there any way to use custom pattern or custom regex in InputMask.
Hello,
Kindly find below Regex that you can use into Input Mask.
"^([A-Za-z0-9!@#$%^&*])+$"
This example to allow only letters from A - Z and a - z , digits from 0 to 9 and some special characters like !@#$%^&* then you can add any special characters you need
@Mostafa OthmanProvided solution is not working. I am looking for a solution to use in this place.regex is not properly working here, is there any other work around.
I think you are using different forge component than the one you mentioned into your question.
You are using this one :
https://www.outsystems.com/forge/component-overview/7838/input-mask-react-o11
Yes. This one only.Updated correct forge component
I don't think you can achieve that with this forge component as its using a: alphabetical which contains all letters and special characters.
So once you add a to MaskPattern all special characters will be allowed.
Hi,
Change local variable Regex based on your requirements
Regards
Shradha
I have updated the forge component.previously mentioned wrong one