The Regular Expression field is a field type that only permits users to enter values that match the 'regular expression' specified in the field.
A regular expression (RegEx) defines a search pattern for strings. In Kayako, you can create this type of field which lets you enter a regular expression that Kayako will use to validate any information users enter in this field. This field type is helpful if you want to collect important information accurately that will help your support team resolve the issue faster.
- To add custom fields in Kayako, you will need an administrator account with either the 'Manage conversation fields' or 'Manage custom user and organization fields' permissions, depending on the type of field you're creating.
- Knowledge of regular expressions - If you want to read up on regular expressions or test out some of your own, we recommend a tool like PHP Live Regex.
To create regular expression fields:
- Sign in to Kayako and go to the admin area.
- Click Custom fields under Customizations.
- Depending on the kind of field you're creating, click either Conversation fields, Organization fields, or User fields on the sidebar.
- Here, you'll see a list of system and custom fields that have been created already. Click the New field button to start customizing a new one.
- Choose the Regular expression option.
- In the Field title text box, enter a descriptive title for the field.
NOTE: This is only an internal title — it will not be visible to your customers.
- If you're creating a conversation field, you can make it mandatory for your agents when updating or resolving a conversation. Just check the Creating, replying to, or updating a conversation and/or the Resolving a conversation box.
- Check the Customers can see this field box to make the field visible to your customers.
- In the 'Field title for customers' text box, enter a label for the field.
- In the 'Field description for customers' text box, enter a brief description of the field.
- You can make conversation and user fields usable by your customers as well. Check the Customers can edit this field box to enable your customers to use the field, and the 'This field is required for customers' box to make it mandatory.
- Enter the regex text in the Regular expression field.
- NOTE: This example will match the word "this" followed by one or more whitespace characters followed by the word "is" followed by one or more whitespace characters followed by the word "text".
- When you've finished, click the Save button.
Once your field is created, any new field you create will be available to add and edit on either forms, organization pages, or user profiles. They'll also be available when building SLAs, and other automations. If you're on the Growth, Scale, or Enterprise plans, and you've enabled multiple languages for your Kayako, you can add translated names, descriptions, and values for your fields.
If a user enters a value that does not match the regular expression, they will not be able to submit the form and will receive the error 'The value of the field is invalid'.