Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!usc!bbn.com!papaya.bbn.com!rsalz From: rsalz@bbn.com (Rich Salz) Newsgroups: comp.lang.c Subject: Re: Pattern-matching source code Keywords: pattern,match,grep Message-ID: <3285@litchi.bbn.com> Date: 15 Feb 91 16:18:47 GMT References: <1991Feb14.143705.3911@ux1.cso.uiuc.edu> Organization: BBN Systems and Technology, Inc. Lines: 20 In <1991Feb14.143705.3911@ux1.cso.uiuc.edu> gordon@osiris.cso.uiuc.edu (John Gordon) writes: |/*********** MATCH.C ************************ Listing 1 *********** | * Author: Allen I. Holub | * Function: A group of subroutines to find a substring represented | * by a grep-like regular expression in a second string. |typedef enum action /* These are put in the pattern string */ { | /* to represent metacharacters. */ | M_BOL = ( 0x80 | '^' ), M_EOL = ( 0x80 | '$' ), ... |} |action; | |typedef unsigned char pattern; /* pattern strings are unsigned char */ Note that this code assumes 7bit chars. It won't work with extended alphabets, or even on a PC where you could have graphics characters. /r$ -- Please send comp.sources.unix-related mail to rsalz@uunet.uu.net. Use a domain-based address or give alternate paths, or you may lose out.