About broader rules with regular expressions

With the JSON rules, you usually make pairs of specific pages and specific users. However, you can also use regular expressions to make broader pairs, such as training several groups of users on one or more groups of pages.

For example, you are working with the following user groups and page labels:

User groupsPage labels

trn_employees

trn_docs

trn_managers

trn_policies

trn_hr

trn_forms

If you want to make sure all user groups train the trn_policies pages, the quickest approach would be to use a regular expression.

Regular expressions

With a regular expression you can refer to a part of your value without limiting yourself to the exact wording. For example, when you are defining your user groups, you could use the value 'trn_+'. The + indicates that whatever comes next is unimportant and the rule will apply to any user group that starts with the characters 'trn_'.

You can apply this to both page filters and user filters:

"pageFilter":
    {"type": "PAGE_LABEL ", "value": "trn_+"}
"userFilter":
    {"type": "USER_GROUP", "value": “trn_+"}

Example

In the example below, any users in a group that starts with 'trn_' will train on any document that has a page label that starts with 'trn_':

{
  "rules": [
    {
      "name": "Filter by trn_*",
      "pageFilter": {
            "type": "PAGE_LABEL",
            "value": "trn_+"
      },
      "userFilter": {
        "type": "USER_GROUP",
        "value": "trn_+"
      },
      "ruleTypes":  {
          "ruleType": "NOT_TRAINED_VERSION"
      }
    }
  ]
}


As always, you can combine rules with the AND/OR options. 

In the following example, your rule applies to all pages starting with 'trn_' within the 'Quality Documents' space.

"pageFilter": {
        "and": [
          {"type": "PAGE_SPACE_KEY", "value": "QualityDocuments"},
          {"type": "PAGE_LABEL", "value": "trn_+"}
		]
		}