9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@labs.coraid.com>
To: 9fans@9fans.net
Subject: Re: [9fans] regexp doubt
Date: Tue, 13 Jul 2010 12:00:46 -0400	[thread overview]
Message-ID: <b5d8f679ca37f573d37735ce19235184@coraid.com> (raw)
In-Reply-To: <AANLkTimt-N7AHo_3d9sOnHKH-dpDNsD_H0ZzogJ8_EB5@mail.gmail.com>

> I wasn't searching, but using it with acme's x command.
>
> > if you are doing a b3 search, you want
> >
> >        :/stat[abc]?[ ;\-]/
> >
> > just the leading : is missing.

this works for me on a buffer of "stat-\n\n\n\n"
(where \ns are newlines):

	Edit ,x/stat[abc]?[ ;\-]/p

> As I recall, if you're going to include a hyphen in a character
> class, it has to be the first character so that it isn't taken to
> indicate a range.

from regexp(6)
[...]
	In s {as in [s-s]}, the metacharacters `-',
	`]', an initial `^', and the regular expression delimiter
	must be preceded by a `\'; other metacharacters have no spe-
	cial meaning and may appear unescaped.

> maybe I'm using a buggy version of acme, because /stat[abc]?[- ;]/
> also fails with a "malformed" error. And according to the regexp(7)
> man page, you should be able to precede a '-' with a backslash.

no, the correct version is
	 /stat[abc]?[\- ;]/

- erik



  reply	other threads:[~2010-07-13 16:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-13 14:56 hugo rivera
2010-07-13 15:01 ` Vinu Rajashekhar
2010-07-13 15:11   ` hugo rivera
2010-07-13 15:15   ` Rodolfo (kix)
2010-07-13 15:31     ` hugo rivera
2010-07-13 15:37       ` blstuart
2010-07-13 15:46         ` hugo rivera
2010-07-13 15:50         ` Ethan Grammatikidis
2010-07-13 15:18 ` erik quanstrom
2010-07-13 15:31   ` hugo rivera
2010-07-13 16:00     ` erik quanstrom [this message]
2010-07-13 18:38       ` Russ Cox
2010-07-13 18:46         ` blstuart
2010-07-14  7:47           ` hugo rivera
2010-07-13 18:47         ` erik quanstrom
2010-07-13 18:49         ` erik quanstrom
2010-07-13 18:57         ` erik quanstrom
2010-07-14 18:11           ` Russ Cox
2010-07-15  8:15             ` hugo rivera
2010-07-13 15:48 ` yy

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=b5d8f679ca37f573d37735ce19235184@coraid.com \
    --to=quanstro@labs.coraid.com \
    --cc=9fans@9fans.net \
    /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).