Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.unix.wizards Subject: Re: BSD re_comp() and re_exec() problem Message-ID: <8138@mimsy.UUCP> Date: Tue, 25-Aug-87 01:10:43 EDT Article-I.D.: mimsy.8138 Posted: Tue Aug 25 01:10:43 1987 Date-Received: Wed, 26-Aug-87 01:52:32 EDT References: <1358@osiris.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 27 Keywords: is it stupid || am I? In article <1358@osiris.UUCP> mjr@osiris.UUCP (Marcus J. Ranum) writes: >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. ... > >I tried the following: [paraphrased] char *fp = "aplcen!mjr", *ap; if (ap = re_comp("aplcen!*")) { printf("err - %s\n",ap); exit(1); } if (re_exec(fp)) printf("match one!\n"); if (ap = re_comp("*!*)) { printf("err - %s\n",ap); exit(1); } if (re_exec(fp)) printf("match two!\n"); Remember, re_comp compiles an *ed*-style regular expression, not a shell-style file match expression. Try compiling `aplcen!.*' and `.*!.*' instead. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690) Domain: chris@mimsy.umd.edu Path: seismo!mimsy!chris