Regex validation format

Hi all,

I am looking to put write a validation condition for one attribute in the registration page in a tracker: BI (identification card number). It should consist of 11 digits plus a letter (110300175184E), so I would like a regex expression to limit digits to 11 + letter. Otherwise, an error message must be shown to tell the user to write the BI correctly.

Thank you,

The example you mentioned above consists more than 11 digits but I hope this works if it does please mark the post as a solution
d2:hasValue(A{BI}) && d2:length(A{BI}) == 12 && d2:validatePattern( A{BI}, ‘\d{11}\w{1}’)

1 Like

For this you should use the d2:validatePattern function.

I am using something different than @Gassim to achieve a cleaner result (assuming only capitals are allowed):

Incorrect:


2022-08-03
Correct:

1 Like

Hi @jaime.bosque,

The program rule works as shown in demo below, but it does not stop me from proceeding if I click on save and continue and sometimes users may likely ignore the warning message, so the warning should be displayed and no data should be saved if there’s a response that violates the validation. Any more ideas?

Thanks

The you’d probably want to select “Show Error” rather than a warning message because an error can’t be ignored.
50%

1 Like