rx_t *pp = p_new(rx_t, 1);
pp->pattern = m_strdup(s);
- pp->rx = p_new(regex_t, 1);
+ pp->rx = p_new(regex_t, 1);
+ pp->flags = flags;
if (REGCOMP(pp->rx, NONULL(s), flags) != 0) {
rx_delete(&pp);
return pp;
}
+rx_t *rx_dup(rx_t *r)
+{
+ rx_t *res = rx_compile(r->pattern, r->flags);
+ res->neg = r->neg;
+ rx_set_template(res, r->tpl);
+ return res;
+}
+
int rx_validate(const char *s, char *errbuf, ssize_t errlen)
{
regex_t re;
m_strreplace(&rx->tpl, tpl);
rx->nmatch = 0;
+ if (m_strisempty(rx->tpl))
+ return;
while ((p = strchr(p, '%'))) {
if (isdigit(*++p)) {