SAP Knowledge Base Article - Public

2668688 - National ID Card: How to create custom Regular Expression and Display Format


  • How to create a custom Regular Expression and Display Format for a Country
  • When entering a National ID I get an error "Please enter a valid National identity number"


SAP SuccessFactors Employee Central


National ID Card (nationalIdCard) configuration can be maintained via Admin Center > Manage Business Configuration (please refer to article 2472343 for further guidance).

Here you can create a some simple validation to ensure when the ID number is entered into the system, it is entered in the correct format.

To be able to setup the Regular Expression and Display Format so they work, you will need to ensure they are configured the same.


GENERAL NOTE: You must include any spaces, hyphens and other symbols that are used in the Display Format, in the Regular Expression.


For example, the following Regular Expression and Display Format are not configured correctly:

  • Display Format = N NNNN NNNN NN
  • Regular Expression = [\d]{11}


The reason the above is not correct, is because in the Display Format you have specified spaces in between each set of numbers. Therefore the Regular Expression must also be setup the same way, with spaces and to check each set of digits between each space. For exampe, the correct format based on the above requirement is -:

  • Display Format = N NNNN NNNN NN
  • Regular Expression = [\d]{1} [\d]{4} [\d]{4} [\d]{2}

Notice that each number group from the Display Format is checked individually, and the spaces between the numbers in the Display Format are also included in the Regular Expression.


Another example might be where you are wanting to use a hyphen to separate the digits. The same logic applies as per above. Example of a correct config using hyphens in the Display Format is -:

  • Display Format = N-NNNN-NNNN
  • Regular Expression = [\d]{1}-[\d]{4}-[\d]{4}


For further information regarding the configuration of pre-delivered National ID formats, please refer to the Country Specifics handbook.

See Also

2472343 - How to manage National ID Formats via Manage Business Configuration (BCUI)


Please enter a valid National identity number, nationalIdCard, reg-ex, display-format, regular expression , KBA , LOD-SF-EC-PER-NAT , National ID - Config, Rules, RBP, UI , How To


SAP SuccessFactors Employee Central all versions