From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from highwire.stanford.edu ([171.64.249.40]) by hawkwind.utcs.utoronto.ca with SMTP id <28311>; Thu, 23 Mar 2000 16:43:28 -0500 Received: from aubrey.stanford.edu (jimr@aubrey.Stanford.EDU [171.64.31.58]) by highwire.stanford.edu (8.9.3/HIGHWIRE2.0) with ESMTP id HAA06451 for ; Thu, 23 Mar 2000 07:18:16 -0800 (PST) Message-Id: <200003231518.HAA06451@highwire.stanford.edu> X-url: http://highwire.stanford.edu/~jimr/ X-face: "!ZH^<"U,NeU:732A To: "sam Fans" Dcc: Subject: Re: shorter struct regex? In-reply-to: Message from "Russ Cox" of "Wed, 22 Mar 2000 19:26:06 EST."References: <200003230026.TAA06530@smtp3.fas.harvard.edu> <200003230026.TAA06530@smtp3.fas.harvard.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <10134.953824696.1@aubrey.stanford.edu> Sender: jimr@aubrey.stanford.edu Date: Thu, 23 Mar 2000 10:19:04 -0500 > ,x/{\n([^}]+\n)+ }/x/, +[^\n]/x/ +/c/\n / > > Is there way I could of done this with less work? > > > In sam, highlight the suspect arrays and then ,s/, */,\n /g > would work. This is a case where I think using the mouse > makes more sense than typing all the gook. Ah, but the point was to do this without the mouse. =) Not because I'm perverse, but because I had about 30 of these arrays in my program. Plus I'm writing it in noweb, so I had a mix of latex documentation mixed in with the code (which about doubles the size of the file). > But if you want > to type the gook, can't you just say > > ,x/{([^}]|\n)+}/,s/, */,\n /g The extra ',' in there before s/// would mess things up. But with a few tweaks, like making sure it doesn't add a newline if one already exists: ,x/{([^}]|\n)+}/s/, *[^\n]/,\n /g It works and would have saved 8 characters. Thank you! Jim