Starting with vCommander® 5.1, administrators can specify a format for text type custom attributes, and validate user entry against the pattern they established. The patterns are set using regular expressions.

  1. Under the Configuration menu, click Custom Attributes.
  2. Click Add.
  3. Enter a meaningful Name and Description for your custom attribute.
  4. Choose against which objects the custom attribute will be applied.
  5. Select Text type.

  6. Leave Edit in Service Portal checked if users must be able to set the value, otherwise no entry will be permitted via the service portal. Click Next.
  7. Select Specific Format and enter the regular expression.
  8. Enter the message that will be displayed to users if their entry does not match your desired pattern. For example, if you want an IP address, a good message would be: Please enter a valid IP address.
  9. Enter a non-matching string and click Test. Continuing the example above, you could test using an invalid address like 10.10.10.259.

  10. Click Finish.


Example Patterns


The list below contains some example patterns which you may find useful. There are many resources available on the Internet which provide additional examples.

Set Number of Alphanumeric Characters


   

[A-Za-z0-9]{1,15}

  

In the example above, the character limit is 15, suitable for use with NetBIOS naming. 


Email Address

 

^[0-9a-zA-Z]+([0-9a-zA-Z]*[-._+])*[0-9a-zA-Z]+@[0-9a-zA-Z]+([-.][0-9a-zA-Z]+)*([0-9a-zA-Z]*[.])[a-zA-Z]{2,6}$

 

IP Address

 

^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$

 

URL

 

(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$

 

Dollar Value

 

^\$(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$

 

Positive Integer

 

^\d+$

 

Major Credit Cards (MC/VISA/AMEX)

 

^((4\d{3})|(5[1-5]\d{2})|(6011))-?\d{4}-?\d{4}-?\d{4}|3[4,7]\d{13}$

 

Password (4-8 characters requiring 1 upper and lower case, 1 digit, no spaces)

 

^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\s).{4,8}$