← Back to team overview

dhis2-devs team mailing list archive

Validate Pattern Not Working for Reg Expression

 

Hi,

Wishing you all a very happy & prosperous  new year.

I am trying to put a validation on one of the attribute for Email.
Following the manual , expression I am using is :

*!d2:validatePattern(#{email},'^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$')*

Which is not working as it validate false every time even if we enter a
valid email i.e: sourabh@xxxxxxxxx

However I have checked d2:validatePattern for other expressions  like :

*!d2:validatePattern(A{name},'[^\\d]*')*

Which is working fine for not contain numbers.

The Reg Expression I am using for email is working fine on normal html.

Has anyone used the validate pattern for email before?

*Dhis2 Version: 2.25*
*Build revision: :8982deb*


Thanks & Regards,
Sourabh Bhardwaj