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/hg/lib/pgSnp.c src/hg/lib/pgSnp.c
index cfb4220..733cb25 100644
--- src/hg/lib/pgSnp.c
+++ src/hg/lib/pgSnp.c
@@ -1,28 +1,28 @@
 /* pgSnp.c was originally generated by the autoSql program, which also 
  * generated pgSnp.h and pgSnp.sql.  This module links the database and
  * the RAM representation of objects. */
 
 #include "common.h"
 #include "linefile.h"
 #include "dystring.h"
 #include "jksql.h"
 #include "pgSnp.h"
 #include "hdb.h"
 #include "dnaseq.h"
 #include "pgPhenoAssoc.h"
-#include "hgFindSpec.h"
+#include "regexHelper.h"
 
 static char const rcsid[] = "$Id: pgSnp.c,v 1.8 2010/03/08 17:45:41 giardine Exp $";
 
 void pgSnpStaticLoad(char **row, struct pgSnp *ret)
 /* Load a row from pgSnp table into ret.  The contents of ret will
  * be replaced at the next call to this function. */
 {
 
 ret->bin = sqlUnsigned(row[0]);
 ret->chrom = row[1];
 ret->chromStart = sqlUnsigned(row[2]);
 ret->chromEnd = sqlUnsigned(row[3]);
 ret->name = row[4];
 ret->alleleCount = sqlSigned(row[5]);
 ret->alleleFreq = row[6];
@@ -662,30 +662,30 @@
 item->chrom = cloneString(row[0]);
 item->chromStart = lineFileNeedNum(lf, row, 1);
 item->chromEnd = lineFileNeedNum(lf, row, 2);
 if (item->chromEnd < 1)
     lineFileAbort(lf, "chromEnd less than 1 (%d)", item->chromEnd);
 if (item->chromEnd < item->chromStart)
     lineFileAbort(lf, "chromStart after chromEnd (%d > %d)",
         item->chromStart, item->chromEnd);
 /* use pattern match to check values and counts both */
 /* alleles are separated by / and can be ACTG- */
 item->name = cloneString(row[3]);
 /* allele count, positive integer matching # of alleles */
 item->alleleCount = lineFileNeedNum(lf, row, 4);
 char alleles[128]; /* pattern to match alleles */
 safef(alleles, sizeof(alleles), "^[ACTG-]+(\\/[ACTG-]+){%d}$", item->alleleCount - 1);
-if (! matchRegex(row[3], alleles))
+if (! regexMatchNoCase(row[3], alleles))
     lineFileAbort(lf, "invalid alleles %s", row[3]);
 /* read count, comma separated list of numbers with above # of items */
 item->alleleFreq = cloneString(row[5]);
 char pattern[128];
 safef(pattern, sizeof(pattern), "^[0-9]+(,[0-9]+){%d}$", item->alleleCount - 1);
-if (! matchRegex(row[5], pattern))
+if (! regexMatchNoCase(row[5], pattern))
     lineFileAbort(lf, "invalid allele frequency, %s with count of %d", row[5], item->alleleCount);
 /* scores, comma separated list of numbers with above # of items */
 item->alleleScores = cloneString(row[6]);
 safef(pattern, sizeof(pattern), "^[0-9.]+(,[0-9.]+){%d}$", item->alleleCount - 1);
-if (! matchRegex(row[6], pattern))
+if (! regexMatchNoCase(row[6], pattern))
     lineFileAbort(lf, "invalid allele scores, %s with count of %d", row[6], item->alleleCount);
 return item;
 }