Saturday, 22 August 2020 21:14

Validate Email Address with Regular Expression – SuccessFactor Employee Central

Written by Karthik Viswanathan
Rate this item
(0 votes)
“© 2020. SAP SE or an SAP affiliate company. All rights reserved.” “Used with permission of SAP SE”

Hello All,

In this blog am going to explain how a simple and powerful Regular Expression can be used to Validate email address field on Contact Info Portlet.

Requirement 1: Email address field should mandate with “@” symbol and should have “. (dot)” at any place after @ symbol and can end with any type of domain.

Example: This email address is being protected from spambots. You need JavaScript enabled to view it.or This email address is being protected from spambots. You need JavaScript enabled to view it.or This email address is being protected from spambots. You need JavaScript enabled to view it.

Regular Expression: ^[\w-\.]+@([\w-]+\.)+[\w-]{2,3}$

Below is the explanation for the above to be configured regular expression. we are going to use it on rule to validate email address.

^ Beginning. Beginning of the line.

[ Character Set. Match any character in the set.

\w word. Matches any word character (alphanumeric & underscore).

–  Character. Matches a “-” character

\. Escaped character. Matches a “.” character

] close character set

+ Quantifier. Match 1 or more of the preceding character or token

@ Character. Matches a “@” character.

(  Capturing groups. opens a capture group

) Capturing groups. closes a capture group

{2,3} Quantifier. Match between 2 and 3 of the preceding character or token

$ End. End of the line.

Now that we got a fair idea of those expressions, let us see how we can configure above expression to a rule to validate email address.

Create a “IF” condition with “Matches” function like below and have a error message to “Then” condition

Attach the above rule to OnChange – Email address field and OnSave – Email Address Portlet.


Requirement 2: Email address field should mandate with “@” symbol and should end with “.COM” only.

Example: This email address is being protected from spambots. You need JavaScript enabled to view it. (Note: should accept only .com)

Regular Expression: ^[\w-\.]+@([\w-]+\.[com]{3})$


Requirement 3: Email address field should mandate with “@” symbol and should end with particular domain Only.

Example: This email address is being protected from spambots. You need JavaScript enabled to view it.  (should end with @karthik.com only.)

Regular Expression: ^[\w-\.]+@([karthik]{7}+\.[com]{3})$

Regular Expression is a very simple and a powerful expression which can be used in many ways for these kind of validations, it can be used over any string field for character set validations also.

Keep Exploring. Thanks for reading.

Read 158 times

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.