Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site burl.UUCP Path: utzoo!watmath!clyde!burl!rcj From: rcj@burl.UUCP (R. Curtis Jackson) Newsgroups: net.wanted.sources Subject: Re: Magic string pattern matching (as in vi) Message-ID: <643@burl.UUCP> Date: Fri, 15-Feb-85 09:03:53 EST Article-I.D.: burl.643 Posted: Fri Feb 15 09:03:53 1985 Date-Received: Sat, 16-Feb-85 06:03:53 EST References: <152@sdcc13.UUCP> Organization: AT&T Technologies, Burlington NC Lines: 43 > > > Does anybody have a procedure/function that compares two strings, > one which has "magic" wildcards (as in "vi" and "grep")? For example, > I need to be able to search for a string that matches some pattern like: > > "beginning .* end" > > which would match if it found the string: > > "beginning with some text in the middle end". > > Having both a "search" and a "compare" function would be most useful, > but I could always make one from the other. > > Thanks, > Victor Romano. Well, I would gladly tell you to use the regular expression functions with Sys V, if I only knew if you were running Sys V. Something that quite a few people forget to do in source requests is to provide the following: Type of computer you are running on (Vax 11/780, 3B20, etc.) Type and release of operating system (Unix V7, VMS 1.3, BSD 4.2, etc.) Also, if possible, tell what avenues you may have tried -- for Victor I would normally say "use lex", since lex is perfect for what he wants. He may have already tried lex and been confused by it or had some trouble using it; it'll save both of us time if I know that. This isn't a poke at you, Victor; just a reminder to people to tell us in net.wanted.* what type of environment you are working in -- telling a tire dealer that you want snow tires is pretty useless if he doesn't know what size you need. By the way, to make this useful rather than pedantic, I do strongly recommend lex if you are writing for a specific application. If you are looking for generic functions and you have them available, try using regcmp(3X) and regex(3X) if they are available. -- The MAD Programmer -- 919-228-3313 (Cornet 291) alias: Curtis Jackson ...![ ihnp4 ulysses cbosgd mgnetp ]!burl!rcj ...![ ihnp4 cbosgd akgua masscomp ]!clyde!rcj