Hi Guys!
I want to create a mask for a field of type Number, which accepts the following sequences:
0345678901
486793625
that is ninedigits can start with 0
or else that allows the empty field without any number typed.
I'm using regex to validate this information"^[0-9]{9}|^$"
however it is not accepting when the sequence of digits starts with "0" or when the user does not type any value.
To test it in OutSystems, I use the Regex How To component (it has a sandbox which you can try). I was able to test it successfully using the demo, as you can see on the screenshot below:
Cheers,João
Hi Fabiano,
From your example, I deduct that your expression can be empty or having 9 digits or start with a 0 followed by 9 digits, is that it?
In that case, the Regex pattern would be:
^(0{0,1})(\d{9})$|^$
It has nine digits with nothing before or with a 0 before, or it is empty.
Kind Regards,João
testing the expression on https://regexr.com/
it works correctly, however when I put it inside a regex in outsystems it does not recognize the Zero and the empty field