regular expression validation

Hi, How can I validate my input with regular expressions? I wont to input must be just ENGLISH letters not Russian, Spain or other languages
thank you in advance 

Champion

Hello Giorgi 

You can use regular expressions to check if the characters are only a, b, c...z or A, B, C...Z:

using System.Text.RegularExpressions;

Regex rgx = new Regex("^[a-zA-Z]+$");

if (rgx.IsMatch(inputData))
   // input data is in English alphabet; take appropriate action...
else
   // input data is not in English alphabet; take appropriate action...

But in case of Regular Expression you will need to add a dependency to the Text extension. Please Read this Document of Outsystems on REGEX


The second would be to use some sort of JavaScript mask library, such as https://imask.js.org/ so you prevent users to insert any data that you don't want them to, but anyway, you should validate the data in the backend if you follow this approach. You can take a look at Custom Input Masks forge component, to start.


Many Thanks

Hello @Giorgi Dzirkvelishvili ,

You can use simple javascript for achieving this, try
$parameters.ModifiedText = $parameters.TextToModify.replace(/[^a-zA-Z\s]/g, '');
in onKeyup action.

Regards,
Boobalan

Capture.PNG

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