1b99bc125d897c0712377c4fb4d23ff9f6cbca9f
angie
  Fri Feb 25 11:43:27 2011 -0800
New src/inc/regexHelper.h module replaces the regex conveniencefunctions that were previously down in hg/lib/hgFindSpecCustom.c.
The primary motivation for this is so I can use regex functions in
the new src/lib/vcf.c for Feature #2821 (VCF parser), but I hope
this will make it easier in general to use regexes in any new code.

diff --git src/inc/regexHelper.h src/inc/regexHelper.h
new file mode 100644
index 0000000..37c5e70
--- /dev/null
+++ src/inc/regexHelper.h
@@ -0,0 +1,29 @@
+/* regexHelper: easy wrappers on POSIX Extended Regular Expressions (man 7 regex, man 3 regex) */
+
+#ifndef REGEXHELPER_H
+#define REGEXHELPER_H
+
+#include "common.h"
+#include <regex.h>
+
+const regex_t *regexCompile(const char *exp, const char *description, int compileFlags);
+/* Compile exp (or die with an informative-as-possible error message).
+ * Cache pre-compiled regex's internally (so don't free result after use). */
+
+boolean regexMatch(const char *string, const char *exp);
+/* Return TRUE if string matches regular expression exp (case sensitive). */
+
+boolean regexMatchNoCase(const char *string, const char *exp);
+/* Return TRUE if string matches regular expression exp (case insensitive). */
+
+boolean regexMatchSubstr(const char *string, const char *exp,
+			 regmatch_t substrArr[], size_t substrArrSize);
+/* Return TRUE if string matches regular expression exp (case sensitive);
+ * regexec fills in substrArr with substring offsets. */
+
+boolean regexMatchSubstrNoCase(const char *string, const char *exp,
+			       regmatch_t substrArr[], size_t substrArrSize);
+/* Return TRUE if string matches regular expression exp (case insensitive);
+ * regexec fills in substrArr with substring offsets. */
+
+#endif // REGEXHELPER_H