Enforcing a Format for Phone Numbers by Using Regular Expressions
Step 1: Configuring the Policy Object
You can configure the Policy Object you need by modifying the Policy Object that implements the previous scenario, see “Scenario 1: Enforcing a Format for Phone Numbers by Using a Mask” earlier in this section. Display the Properties dialog box for that Policy Object and go to the Policies tab. Then, select the policy from the list, and click View/Edit to display the Property Generation and Validation Policy Properties dialog box. The Policy Rule tab in the Property Generation and Validation Policy Properties dialog box looks similar to the Configure Policy Rule page in the wizard you used to configure the policy. You can use that tab to modify the policy rules. First, modify the rule to remove the mask entry. On the Policy Rule tab, in the upper box, clear the ‘Telephone Number’ must be <value> check box. Next, choose to configure a rule based on regular expressions. On the Policy Rule tab, in the upper box, select the ‘Telephone Number’ must match regular expression <value> check box. To access this check box, you need to scroll down the list of check boxes. Finally, specify the regular expressions that define the policy in question. The regular expressions you need are as follows:
^\+([0-9]+ )+[0-9]+$ = +(12)12345678
^\+([0-9]+ )+x[0-9]+$ = +(123456)x123
^\([0-9]{3}\)[0-9]{3}\-[0-9]{4}$ = (123)123-1234
Thus, the policy must be configured to only allow the telephone numbers that match ^\+([0-9]+ )+[0-9]+$ (telephone numbers without extensions) or ^\+([0-9]+ )+x[0-9]+$ (telephone numbers that include extensions). Proceed with configuring the policy as follows:
1. On the Policy Rule tab, in the lower box, click the link labeled <click to add value>.
2. In the Add Value dialog box, enter ^\+([0-9]+ )+[0-9]+$, and click OK.
3. On the Policy Rule tab, in the lower box, click the link labeled <click to add value>.
4. In the Add Value dialog box, enter ^\+([0-9]+ )+x[0-9]+$, and click OK.
5. Click OK to close the Property Generation and Validation Policy Properties dialog box.
Step 2: Applying the Policy Object
You can apply the Policy Object without closing its Properties dialog box. Go to the Scope tab and do the following:
1. On the Scope tab, click the Scope button to display the ActiveRoles Server Policy Scope window for the Policy Object you are managing.
2. Click Add and select the domain, OU, or Managed Unit where you want to apply the policy. You can also use the Remove button to remove items where you want the policy to no longer be applied.
3. Click OK to close the ActiveRoles Server Policy Scope window.
4. Click OK to close the Properties dialog box for the Policy Object.
see page 152-> Of the ARS 6.7 Admin guide for more information
see page 496-> Of the ARS 6.7 Admin guide for the regular expression matrix for custom formatting using regular expressions
© 2025 One Identity LLC. ALL RIGHTS RESERVED. Termini di utilizzo Privacy Cookie Preference Center