From: Byron Rakitzis <byron>
To: rc
Subject: Re: Match operator puzzlement
Date: Sat, 1 Feb 1992 11:49:02 -0600 [thread overview]
Message-ID: <92Feb1.114911cst.18888@archone.tamu.edu> (raw)
Hm. I think I can do a little better than John here. The two following
sed substitutions should be ok to quote all characters in a word except
the metacharacters *, ? and [. The sed scripts will FAIL if there are
single quotes in the input, but I'm sure there's a way around that
problem too, I just haven't thought of a good way yet.
Anyway:
First you turn all single non-meta characters into quoted characters:
sed 's/\([^[*?]\)/''\1''/g' # using rc's quoting rules, of course.
e.g., "Hello?" goes to "'H''e''l''l''o'?"
Now you need to remove all '' sequences:
sed 's/''''//g'
Now "Hello?" becomes "'Hello'?", which is exactly what we want. Not bad.
(BTW, I think I can prove by induction that this method works for all
strings which do not contain a ', but I do not have enough room
to write the proof here :-)
So the ~ example becomes something like:
eval ~ 'subject' `{echo $funky_pattern | sed garbage}
next reply other threads:[~1992-02-01 17:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
1992-02-01 17:49 Byron Rakitzis [this message]
1992-02-01 18:02 ` John Mackin
-- strict thread matches above, loose matches on Subject: below --
1992-02-03 17:09 Byron Rakitzis
1992-02-02 20:20 Tom Culliton x2278
1992-02-01 19:46 malte
1992-02-01 18:43 malte
1992-01-31 21:01 Tom Culliton x2278
1992-02-01 16:02 ` John Mackin
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=92Feb1.114911cst.18888@archone.tamu.edu \
--to=rc@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).