Pattern constraints are implemented using "RegExp" which is quite flexible. If you want to learn more about regular expression, here is a good article: https://carlalexander.ca/beginners-guide-regular-expressions/ However, you do not need to learn "RegExp" in order to use pattern constraints. 


Some examples of different pattern constraints are:


  • Names: You may want to allow only alphabetic characters, whitespace, dots, etc. For example, for "Jr." you would use [a-zA-Z\s\.]* (allows you to enter blank names).
  • Email: It consists of several parts - "username" which is any non-whitespace character of any length, @ character as a separator, then a "hostname" which always consists of at least one dot. Therefore, your rule may look like this: \S+@\S+\.\S+.
  • Company email: For example, you want to force the customer to specify a company domain that ends with @companyname.com. You would use \S+@companyname\.com.
  • Date in a specific format: For example, if you want to force the date format "mm/dd/yyyy" without ensuring that the user chooses a correct month or date, use [0-9]{2}\/[0-9]{2}\/[0-9 {4}


Basic Information

You just need to list the characters the text should match. It may be: 

  • A single character, which will be applied literally (except for special characters). 
  • A list of allowed characters, e.g. to allow only vowels in lower case, you may use [aeiou].
  • A range of allowed characters, e.g. to allow only upper case characters, use [A-Z], to allow both upper and lower case - [a-zA-Z], only numbers - [0-9]. 


Shortcuts

  • \w - any "word" character, e.g. [a-z, A-Z, 0-9].
  • \d - digits, e.g. equivalent to [0-9].
  • \s - whitespace.
  • Same shortcuts in upper case - inverts them (e.g. \D is non-digit, \W - non-"word", \S - non-whitespace).
  • Special characters, e.g. a period character “.” means "any character". 
  • If you need to use some special character literally, you need to put a slash, e.g. to match a dot literally, you need to use \.


Quantity Modifiers

  • A question mark - one or zero. E.g. [0-9]? means one digit or an empty string. 
  • An asterisk - any number of characters, including none. E.g. [0-9]* means a number of any length (including a blank string).
  • A plus sign -  any number of characters, but at least one. E.g. [0-9]+ means a number of any length, which should not be blank. 
  • You may even specify a number or a range by adding it in curly braces. E.g. \w{3} means a word of three characters; \w{3,6} - a length should be between 3 and 6.

 

Adding an improper pattern constraint will not “break” the template that the data schema is used on - it will simply format the text improperly when testing OR nothing will show in that field at all. The pattern constraint can be removed from the field within the data schema in order for it to work properly again. 


If you are looking for a specific pattern that is not common, contact us at support@docketmanager.ca and we can write it for you for an additional fee.