Using PCRE to check regexps passed to Apache
[hcoop/domtool2.git] / pcre / pcre_sml.c
diff --git a/pcre/pcre_sml.c b/pcre/pcre_sml.c
new file mode 100644 (file)
index 0000000..48998ba
--- /dev/null
@@ -0,0 +1,15 @@
+#include <pcre.h>
+
+int PCRE_SML_validRegexp(const char *s) {
+  pcre *re;
+  const char *error;
+  int erroffset;
+
+  re = pcre_compile(s, 0, &error, &erroffset, NULL);
+  
+  if (re) {
+    pcre_free(re);
+    return 1;
+  } else
+    return 0;
+}