836
Views
6
Comments
Solved
Removing Special Characters Using an Built In Function
Application Type
Reactive

If I  want to avoid or remove all special characters within a input box or anyother field while doing a form validation, Is there any Built In Function available to do this?

2025-08-07 06-30-56
Amit J
Champion
Solution

You can create a client function in your app using javascript like below.

str.replace(/[^a-zA-Z0123456789]/g, "")

It will simply work.

you can test using the browser console by putting any special character.

const str = "abc's test#s";
console.log(str.replace(/[^a-zA-Z ]/g, ""));


hope, you get my point.
2025-08-07 06-30-56
Amit J
Champion
Solution

you can just remove numbers from the expression 

(str.replace(/[^a-zA-Z0123456789]/g, ""));

i mean you can you 
(str.replace(/[^a-zA-Z/g, ""));

it will accept only a to zA to Z alphabet.
2021-06-02 20-50-04
Márcio Carvalho
Solution

There is already a post on forums with an answer provided by @Benjith Sam, let us know if it works for your use case.

This will help you when you are typing on the input, but you can use the expression just when you are going to the save action. This is up to you now and to the requirements, you have to follow.

https://www.outsystems.com/forums/discussion/62439/restrict-special-characters-in-input-field/


Kind Regards,

Márcio

2025-08-07 06-30-56
Amit J
Champion

Do you want to remove also numbers from the string along with special char?


2025-08-07 06-30-56
Amit J
Champion
Solution

You can create a client function in your app using javascript like below.

str.replace(/[^a-zA-Z0123456789]/g, "")

It will simply work.

you can test using the browser console by putting any special character.

const str = "abc's test#s";
console.log(str.replace(/[^a-zA-Z ]/g, ""));


hope, you get my point.
2025-08-07 06-30-56
Amit J
Champion

Check created OML

https://amitj.outsystemscloud.com/DummyReactiveApp/Demo?_ts=637788875131343484

Created client action we can use anywhere on page for any type of widget.

DummyReactiveApp.oml
2022-01-14 05-01-23
Muthu Prabhakar

Do you want to remove also numbers from the string along with special char? 

Yeah bro.. I need to know that also and it would be very helpful if u provide how to do that also..

Thanks Regards,

Muthu Prabhakar

2025-08-07 06-30-56
Amit J
Champion
Solution

you can just remove numbers from the expression 

(str.replace(/[^a-zA-Z0123456789]/g, ""));

i mean you can you 
(str.replace(/[^a-zA-Z/g, ""));

it will accept only a to zA to Z alphabet.
2021-06-02 20-50-04
Márcio Carvalho
Solution

There is already a post on forums with an answer provided by @Benjith Sam, let us know if it works for your use case.

This will help you when you are typing on the input, but you can use the expression just when you are going to the save action. This is up to you now and to the requirements, you have to follow.

https://www.outsystems.com/forums/discussion/62439/restrict-special-characters-in-input-field/


Kind Regards,

Márcio

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