Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!mimsy!aplcen!osiris!mjr From: mjr@osiris.UUCP (Marcus J. Ranum) Newsgroups: comp.unix.wizards Subject: BSD re_comp() and re_exec() problem Message-ID: <1358@osiris.UUCP> Date: Mon, 24-Aug-87 22:38:57 EDT Article-I.D.: osiris.1358 Posted: Mon Aug 24 22:38:57 1987 Date-Received: Wed, 26-Aug-87 01:51:28 EDT Organization: The Bavarian Illuminati, Inc. Lines: 41 Keywords: is it stupid || am I? I've been playing with the BSD regexp libary routines. I had the same experience with regexp.h, too. Anyhow: expressions like: "aplcen!mj*" and even "aplcen!mj." compile fine using re_comp() and when I try a re_exec() against a string like "aplcen!mjr" they DON'T MATCH if I've already compiled one or more re's. Now, the ed(1) manpage tells me I should get at least something out of that. About the only thing that DID re_exec() okay against my compiled string was "mjr" which DID match. Anyone seen this before ?? I tried the following: extern char *re_comp(); main() { char *fp = "aplcen!mjr"; char *bp = "aplcen!*"; char *qp = "*!*"; char *ap; if(ap = re_comp(bp)) { printf("err - %s\n",ap); exit(1); } else { if(re_exec(fp)) printf("match one!\n"); } if(ap = re_comp(qp)) { printf("err - %s\n",ap); exit(1); } else { if(re_exec(fp)) printf("match two!\n"); } exit(0); } -- If they think you're crude, go technical; if they think you're technical, go crude. I'm a very technical boy. So I get as crude as possible. These days, though, you have to be pretty technical before you can even aspire to crudeness... -Johnny Mnemonic