Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83 (MC840302); site erix.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!mcvax!enea!erix!toni From: toni@erix.UUCP (Toni Roth) Newsgroups: net.text Subject: lex Message-ID: <909@erix.UUCP> Date: Tue, 30-Jul-85 12:09:23 EDT Article-I.D.: erix.909 Posted: Tue Jul 30 12:09:23 1985 Date-Received: Fri, 2-Aug-85 08:02:24 EDT Organization: L M Ericsson, Stockholm, Sweden Lines: 41 I've written a nroff/troff macro package for formatting standard documents. Now I'm trying to use lex to make an "interface" to the user, so he won't have to learn *roff. As an example: if he wants a new line, he writes ":nl." in his document. This is to be translated to ".NL". The problem is that this ":nl." can appear anywhere in the text Look at these examples: 1: text text text text:nl.text text text text 2: text text text text :nl. text text text text 3: text text text text :nl.text text text text 4: text text text text :nl. text text text text I want them all to result in this: text text text text .NL text text text text I could of course write something like: "\n:nl.\n" printf("\n.NL\n"); "\n:nl." printf("\n.NL\n"); ":nl.\n" printf("\n.NL\n"); ":nl." printf("\n.NL\n"); But as the action is the same, I believe there is one pattern that covers all four of these (I don't want ":nl." more than once in the pattern and I want the action part as easy as now). How do I write this pattern? Thanks in advance!