10
Views
5
Comments
Solved
Regex_search giving incorrect results in outsystems mobile for uppercase.

I am trying to add a password validation,

with atleast 12 characters, one uppercase, one lowercase and one special character.

So the regex I have used is -

"^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[[!@#$%^&*()_+\-=\[\]{};':\\|,.<>\/?""])[A-Za-z\d@[!@#$%^&*()_+\-=\[\]{};':\\|,.<>\/?""]{12,}$"

But this is not checking the uppercase parameter. It matches strings like "Password123$" and "password123$" both, whereas it should not for the latter.

I then tried a different regex, to check if string as atleast one uppercase, for which i used this- 

"(?=.*[A-Z])"

This was matching lower case characters as well(ie. "P" and "p" both).

I tried he above regex on sites like regex202, it was working properlyover there.

Please let me know if I am doing something wrong, or some other alternative to regex_search.

Rank: #186
Solution

Hi Amol, did you set as false the ignoreCase, the default is true, so will ignore lowercase and uppercase

Cheers,

Carlos Lessa

Rank: #70

Hi Amol,


I would suggest you to try the component Password Validator Reactive which you can use in Mobile.


It does exactly the kind of validations you want using Regex.


Hope it helps.


Kind regards,

João

Rank: #186

Hi Amol,

try this regex:

^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[[!@#$%^&*()_+\-=\[\]{};':\\|,.<>\/?""])[A-Za-z\d@[!@#$%^&*()_+\-=\[\]{};':\\|,.<>\/?"")[A-Za-z\d@$!%*?&]{12,}$

you test it here: https://regexr.com/ 

hope I could help you

Cheers,

Carlos Lessa

Rank: #1232

Hi Amol,

While the Forge component suggested by Joao Marques could indeed be used to accomplish this goal, the regex you proposed should, to the best of my (admittedly limited) regex knowledge, work just fine. It therefore seems to me that this is a problem with the OutSystems Regex_Search action, so I would suggest to open a support case for it: https://www.outsystems.com/supportportal/OpenNewTicket.aspx

Rank: #186
Solution

Hi Amol, did you set as false the ignoreCase, the default is true, so will ignore lowercase and uppercase

Cheers,

Carlos Lessa

Rank: #186

Amol, here is a demo with both version of the regex, oml is here to download

Hope I could help you

Cheers,

Carlos Lessa


ReactiveTestsRegex.oml