Hi @Manish Aggarwal ,
Thank you for the ask. Would you please check out the link below. Thanks!
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi - We are working on Azure AD B2C implementation, where in we need to validate the signin email entered by customer using a regex validation.
We do the email Verification using claims, but also need to enforce regex validation (Pattern) on client side.
Hi @Manish Aggarwal ,
Thank you for the ask. Would you please check out the link below. Thanks!
Hi @Manish Aggarwal ,
Thanks for reaching out.
I understand you are trying to validate the email entered by customer using a regex validation in B2C custom policy.
You can use pattern element with Regular Expression in order to validate the email id enter by customer. You can customized the regular expression based on your requirement.
<ClaimType Id="email">
<DisplayName>Email Address</DisplayName>
<DataType>string</DataType>
<DefaultPartnerClaimTypes>
<Protocol Name="OpenIdConnect" PartnerClaimType="email"/>
</DefaultPartnerClaimTypes>
<UserHelpText>Email address that can be used to contact you.</UserHelpText>
<UserInputType>TextBox</UserInputType>
<Restriction>
<Pattern RegularExpression="^[a-zA-Z0-9.!#$%&'^_`{}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$" HelpText="Please enter a valid email address."/>
</Restriction>
</ClaimType>
Hope this will help.
Thanks,
Shweta
-----------------------------------------------
Please remember to "Accept Answer" if answer helped you.