Issue symptoms

When creating an entity in an advanced AI agent, you can define rules using regular expressions (RegEx) to match different data sets.

For example, if you're using a regular expression to match a mix of letters and numbers between 5 and 20 characters long, you might be tempted to use the following pattern:

(?=.*\d)[A-Za-z0-9-]{5,20}

Although this regular expression is technically correct, it doesn't work when tested in the AI Agent.

The issue relates to the use of positive lookahead syntax, as shown in the image below. While regex101.com confirms that the expression correctly matches the dataset, it relies on positive lookahead, which may not be supported in AI Agents – Advanced.

Resolution steps

To resolve this issue effectively, avoid using positive lookahead syntax.

Based on the example above, replace the regular expression with an alternative that doesn't use positive lookahead:

[A-Za-z-]*\d[A-Za-z0-9-]{4,19}

For more information, see this article: Creating entities in conversation flows for advanced AI agents

Powered by Zendesk