misc: Move the bsc_parse_reg to libcommom and name it gsm_parse_reg

Move the regexp parsing code from the NAT to libcommon as it will
be used by the NAT and BSC code. This also adds the #include <regex.h>
include to gsm_data. This header should be split up.
diff --git a/openbsc/src/libcommon/gsm_data.c b/openbsc/src/libcommon/gsm_data.c
index c70ffae..8327758 100644
--- a/openbsc/src/libcommon/gsm_data.c
+++ b/openbsc/src/libcommon/gsm_data.c
@@ -419,3 +419,29 @@
 
 	return gsm48_construct_ra(buf, &raid);
 }
+
+int gsm_parse_reg(void *ctx, regex_t *reg, char **str, int argc, const char **argv)
+{
+	int ret;
+
+	ret = 0;
+	if (*str) {
+		talloc_free(*str);
+		*str = NULL;
+	}
+	regfree(reg);
+
+	if (argc > 0) {
+		*str = talloc_strdup(ctx, argv[0]);
+		ret = regcomp(reg, argv[0], 0);
+
+		/* handle compilation failures */
+		if (ret != 0) {
+			talloc_free(*str);
+			*str = NULL;
+		}
+	}
+
+	return ret;
+}
+