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 <26714>; Wed, 22 Mar 2000 17:31:08 -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 VAA13856 for ; Fri, 17 Mar 2000 21:23:13 -0800 (PST) Message-Id: <200003180523.VAA13856@highwire.stanford.edu> X-url: http://highwire.stanford.edu/~jimr/ X-face: "!ZH^<"U,NeU:732A To: "sam Fans" Dcc: Subject: shorter struct regex? MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <23843.953356993.1@aubrey.stanford.edu> Sender: jimr@aubrey.stanford.edu Date: Sat, 18 Mar 2000 00:24:24 -0500 I'm starting to develop some mild RSI problems, and am trying to move away from the mouse. This leads me to look at editors like vi or sam instead of wily. In wily I end up using a pipe to sam half the time anyway, so I'm working through using structured regular expressions while editing my code in sam. I just worked through a problem, and am wondering if there was a shorter way to solve it. I had a bunch of arrays defined in a java file: ... public Hashtable return() throws MissingRequiredValueException { String[] req = { "order-id", "amount" }; String[] opt = { "card-number", "card-exp", "card-name", "card-address", "card-city", "card-zip" }; return processRequest("return", req, opt); } ... I wanted to expand the elements of the arrays to one per line. This is what I used: ,x/{\n([^}]+\n)+ }/x/, +[^\n]/x/ +/c/\n / Is there way I could of done this with less work? Jim - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - James A. Robinson jim.robinson@stanford.edu Stanford University HighWire Press http://highwire.stanford.edu/ 650-723-7294 (W) 650-725-9335 (F)