Regex Pattern Searching in RAD in C

You can also use the extended regular expression (ERE) search capabilities of RAD to search for a zone. For example, you can find only zones with the name test-0 or test-1 as follows.

Example 2-8 C Language – Using Regex Patterns

#include <rad/radclient.h>
#include <rad/radclient_basetypes.h>
#include <rad/client/1/zonemgr.h>

rc_err_t status;
adr_name_t **name_list;
int name_count;

rc_conn_t *conn = rc_connect_unix(NULL, B_TRUE, NULL);
if (conn != NULL) {
      status = zonemgr_Zone__rad_list(conn, B_TRUE, NS_REGEX, 
    &name_list, &name_count, 1, "name", "test-0|test-1");
    if (status == RCE_OK) {
         for (int i = 0; i < name_count; i++) {
              const char *name = adr_name_tostr(name_list[i]);
              printf("%s\n", name);
            }
            name_array_free(name_list, name_count);
        }
}

The key and the value must be valid EREs as determined by the connected RAD instance. The expression is compiled and executed on the server.