45
Views
7
Comments
[Input Mask React] Using regex custom pattern in InputMaskReactiveFlow
inputmask-react
Reactive icon
Forge asset by João Barata
Application Type
Reactive
Service Studio Version
11.54.66 (Build 63364)

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.

2020-11-25 10-45-32
Mostafa Othman
Champion

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

2024-07-22 07-16-15
Rinto Paul

@Mostafa Othman
Provided 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.

2020-11-25 10-45-32
Mostafa Othman
Champion

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


2024-07-22 07-16-15
Rinto Paul

Yes. This one only.
Updated correct forge component

2020-11-25 10-45-32
Mostafa Othman
Champion

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.

2024-07-16 17-36-51
Shradha Rawlani

Hi,

Change local variable Regex based on your requirements

Regards

Shradha

2024-07-22 07-16-15
Rinto Paul

I have updated the forge component.
previously mentioned wrong one

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.