+ ec_free(s);
+ return -1;
+}
+
+static struct ec_node_type ec_node_re_type = {
+ .name = "re",
+ .schema = ec_node_re_schema,
+ .set_config = ec_node_re_set_config,
+ .parse = ec_node_re_parse,
+ .complete = ec_node_complete_unknown,
+ .size = sizeof(struct ec_node_re),
+ .free_priv = ec_node_re_free_priv,
+};
+
+EC_NODE_TYPE_REGISTER(ec_node_re_type);
+
+int ec_node_re_set_regexp(struct ec_node *gen_node, const char *str)
+{
+ struct ec_config *config = NULL;
+ int ret;
+
+ EC_CHECK_ARG(str != NULL, -1, EINVAL);
+
+ if (ec_node_check_type(gen_node, &ec_node_re_type) < 0)
+ goto fail;
+
+ config = ec_config_dict();
+ if (config == NULL)
+ goto fail;
+
+ ret = ec_config_dict_set(config, "pattern", ec_config_string(str));
+ if (ret < 0)
+ goto fail;
+
+ ret = ec_node_set_config(gen_node, config);
+ config = NULL;
+ if (ret < 0)
+ goto fail;
+
+ return 0;
+
+fail:
+ ec_config_free(config);