aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libutil/regexp.c18
-rw-r--r--src/libutil/regexp.h9
2 files changed, 27 insertions, 0 deletions
diff --git a/src/libutil/regexp.c b/src/libutil/regexp.c
index 2fe614e90..9db031109 100644
--- a/src/libutil/regexp.c
+++ b/src/libutil/regexp.c
@@ -54,6 +54,7 @@ struct rspamd_regexp_s {
gpointer re_class;
guint64 cache_id;
gint flags;
+ gint pcre_flags;
gint ncaptures;
gint nbackref;
};
@@ -248,6 +249,7 @@ fin:
res->flags = rspamd_flags;
res->pattern = real_pattern;
res->cache_id = RSPAMD_INVALID_ID;
+ res->pcre_flags = regexp_flags;
if (rspamd_flags & RSPAMD_REGEXP_FLAG_RAW) {
res->raw_re = r;
@@ -489,6 +491,22 @@ rspamd_regexp_get_pattern (rspamd_regexp_t *re)
return re->pattern;
}
+guint
+rspamd_regexp_get_flags (rspamd_regexp_t *re)
+{
+ g_assert (re != NULL);
+
+ return re->flags;
+}
+
+guint
+rspamd_regexp_get_pcre_flags (rspamd_regexp_t *re)
+{
+ g_assert (re != NULL);
+
+ return re->pcre_flags;
+}
+
gint
rspamd_regexp_get_nbackrefs (rspamd_regexp_t *re)
{
diff --git a/src/libutil/regexp.h b/src/libutil/regexp.h
index a64f36e1a..8d3720f3e 100644
--- a/src/libutil/regexp.h
+++ b/src/libutil/regexp.h
@@ -113,6 +113,15 @@ gpointer rspamd_regexp_get_id (rspamd_regexp_t *re);
const char* rspamd_regexp_get_pattern (rspamd_regexp_t *re);
/**
+ * Get PCRE flags for the regexp
+ */
+guint rspamd_regexp_get_pcre_flags (rspamd_regexp_t *re);
+/**
+ * Get rspamd flags for the regexp
+ */
+guint rspamd_regexp_get_flags (rspamd_regexp_t *re);
+
+/**
* Returns number of backreferences in a regexp
*/
gint rspamd_regexp_get_nbackrefs (rspamd_regexp_t *re);