Regular Expressions

From Make 6.1 the ability to use regular expressions to validate user input in input fields when applying a configuration, update, batch or validation request has been added.

To use this functionality add a “regex” : “REGULAR_EXPRESSION” to the parameter field in the parameters JSON. For example if I would like to use a regular expression to validate if a user types an email address I could use the following JSON:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{
   "d":{
      "parameters":[
         {
            "id":"Title",
            "title":"Group Title",
            "inputType":"text",
            "required":true,
            "sampleValue":" RegexExample",
            "value":" RegexExample"
         },
         {
            "id":"mailNickName",
            "title":"Mailbox",
            "inputType":"text",
            "required":true,
            "sampleValue":" RegexExample",
            "value":" RegexExample"
         },
         {
            "id":"url",
            "title":"Url",
            "inputType":"text",
            "required":true,
            "sampleValue":"https://tenant.sharepoint.com/sites/RegexExample",
            "value":"https:// tenant.sharepoint.com/sites/RegexExample"
         },
         {
            "id":"owner",
            "title":"Group Owner 1",
            "inputType":"text",
            "required":true,
            "sampleValue":"person@tenant.onmicrosoft.com",
            "regex":"^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*$"
         },
         {
            "id":"security",
            "title":"security",
            "inputType":"text",
            "required":true,
            "sampleValue":"public",
            "value":"public"
         }
      ]
   }
}
NOTE Be sure to escape characters to make it a valid JSON. As you can see the “\” is escaped by using an additional “\”. An (online) JSON validator is recommended.
NOTE Do not use leading and trailing slashes. “/^[a-zA-Z0-9.!#$%&’*+/=?^_`{

When Applying this configuration using the Make UI. A valid email address must be inserted in the “Group Owner 1” input box. If this is not the case an invalid message will appear and the configuration may not be submitted.

Figure 1: Regular Expressions

Figure 1: Regular Expressions

What's on this Page