Hi
How can I implement Regex_Search with Client Action?
Hi ,
Using javascript you can do the same client side.
you can use "search()" method in javascript.
syntax : string.search(regex);
regards,
pramod.
Hi pramod What should I do if Client Action is Function?
An error like the one below will appear.
Invalid Client Function
'Like_Regex_Search' cannot be used in 'IsRegexSearch' because the execution of an asynchronous JavaScript node is not available in client functions. Change the 'Function' property of the action 'IsRegexSearch' to 'No'.
sorry. I made a mistake. This error occurred when it was used with Server Action.
Hi @Hiroshi Mitsuhashi ,
Can you share the oml?
Regards,
Pramod.
Hi,
Client function definition will look like this
Flow will look like this:
and Js will be like this:
hi Hiroshi Mitsuhashi
i saw your problem. you can try with this javascript code in javascript. just put this javascript code in client action.
function onlyLettersAndSpaces(str)
{
return Boolean(str?.match(/^[A-Za-z\s]*$/));
}
output parameter=onlyLettersAndSpaces(input parameter )
input parameter should be in text format and output parameter should be boolean.
Thanks
Prince
Hi Hiroshi,
Check out Reactive Utilities in the Forge. This component has Regex client capabilities (and more).
Hope this helps,
Vincent
Hi Hiroshi Mitsuhashi ,
You can go through the given code below . also we have I have attached the oml Kindly go through that
Kind Regards
Sourabh sharma
Hi hiroshi,
you can check out this component https://www.outsystems.com/forge/component-overview/4124/client-side-validation
its a action provide text to be validated and provide the regular expression to check for pattern you can built the required pattern from any google documentation or get the pattern from any online regular expression generation site.
Documentation: https://docs.mendix.com/refguide/regular-expressions/#:~:text=A%20regular%20expression%20can%20contain,%E2%80%9Ca%E2%80%9D%20to%20%E2%80%9Cz%E2%80%9D
generate online: https://saasbase.dev/tools/regex-generator
eg. "^(?=.{8,}$)(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*\W).*$" this one is for password must contain a number, uppercase, special character and small case
Also provide with other action inputs like ignore case and other Boolean. Thanks Shlok Agrawal
Hi Shlok,
Do you think it's the right approach to link to the Mendix website? You secretly want OutSystems developers to join the dark side? :)
Hey @Kilian Hekhuis
Apologies but I had no such intentions, when I was performing the exercise on regex_search when I came across this documentation and it helped me. I didn't know that this is not the best way this should be done, will keep this in mind. Thanks for pointing this out. Will do some more research on this and will stick with Outsystems docs. Thanks