From: "James A. Robinson" <jim.robinson@stanford.edu>
To: "sam Fans" <sam-fans@hawkwind.utcs.toronto.edu>
Subject: shorter struct regex?
Date: Sat, 18 Mar 2000 00:24:24 -0500 [thread overview]
Message-ID: <200003180523.VAA13856@highwire.stanford.edu> (raw)
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)
next reply other threads:[~2000-03-22 22:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-03-18 5:24 James A. Robinson [this message]
2000-03-23 0:05 Byron Rakitzis
2000-03-23 9:51 Bengt Kleberg
[not found] <rsc@plan9.bell-labs.com>
[not found] ` <200003230026.TAA06530@smtp3.fas.harvard.edu>
2000-03-23 15:19 ` James A. Robinson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200003180523.VAA13856@highwire.stanford.edu \
--to=jim.robinson@stanford.edu \
--cc=sam-fans@hawkwind.utcs.toronto.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).