From: Aharon Robbins <arnold@skeeve.com>
To: 9fans@9fans.net, rudolf.sykora@gmail.com
Subject: Re: [9fans] non greedy regular expressions
Date: Fri, 24 Oct 2008 13:27:20 +0200 [thread overview]
Message-ID: <200810241127.m9OBRKGB004251@skeeve.com> (raw)
You are not missing anything.
Subexpression matching means when you have an expression like
q(a+b)(c*d)z
that you can get access to the exact text matched by the two
parenthesized subexpressions.
You asked about non-greedy regular expressions which were first
popularized by perl.
IIRC the Plan 9 regex library does not provide this at all; Bell Labs
code never did non-greedy regexp matching.
Rob and/or Russ can correct me if I'm wrong.
FWIW, tools from the GNU world also do not support non-greedy
matching, nor are such expressions part of POSIX.
Hope this helps,
Arnold
> > russ has a great writeup on this.
> > http://swtch.com/~rsc/regexp/
> > i think it covers all your questions.
> >
> > - erik
>
> I read trough some of that already yesterday. Anyway, am still
> puzzled. In the text of
>
> Regular Expression Matching Can Be Simple And Fast
> (but is slow in Java, Perl, PHP, Python, Ruby, ...)
>
> R. Cox writes:
> ---
> While writing the text editor sam [6] in the early 1980s, Rob Pike
> wrote a new regular expression implementation, which Dave Presotto
> extracted into a library that appeared in the Eighth Edition. Pike's
> implementation incorporated submatch tracking into an efficient NFA
> simulation but, like the rest of the Eighth Edition source, was not
> widely distributed.
> ...
> Pike's regular expression implementation, extended to support Unicode,
> was made freely available with sam in late 1992, but the particularly
> efficient regular expression search algorithm went unnoticed. The code
> is now available in many forms: as part of sam, as Plan 9's regular
> expression library, or packaged separately for Unix.
> ---
>
> But any manual page (regexp(6), that of sam) keeps completely silent
> about eg. any submatch tracking.
> So what's wrong? Can anybody clarify the situation for me or do I
> really have to read the codes?
>
> Ruda
>
next reply other threads:[~2008-10-24 11:27 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-24 11:27 Aharon Robbins [this message]
-- strict thread matches above, loose matches on Subject: below --
2008-10-27 21:08 Aharon Robbins
2008-10-28 14:53 ` Eris Discordia
2008-10-27 20:00 Eris Discordia
2008-10-28 14:51 ` Brian L. Stuart
2008-10-28 15:07 ` Eris Discordia
2008-10-27 19:23 Aharon Robbins
2008-10-27 20:15 ` Eris Discordia
2008-10-23 18:58 Rudolf Sykora
2008-10-23 19:05 ` erik quanstrom
2008-10-24 8:08 ` Rudolf Sykora
2008-10-24 12:23 ` erik quanstrom
2008-10-24 16:11 ` Rudolf Sykora
2008-10-24 16:54 ` erik quanstrom
2008-10-24 17:02 ` John Stalker
2008-10-24 17:15 ` Rob Pike
2008-10-24 17:41 ` Rudolf Sykora
2008-10-24 18:01 ` Russ Cox
2008-10-24 19:56 ` Rudolf Sykora
2008-10-24 21:10 ` Russ Cox
2008-10-24 21:40 ` Rudolf Sykora
2008-10-24 21:47 ` erik quanstrom
2008-10-24 22:04 ` Rudolf Sykora
2008-10-24 22:38 ` Gabriel Diaz Lopez de la Llave
2008-10-24 22:54 ` Charles Forsyth
2008-10-24 22:59 ` Charles Forsyth
2008-10-24 23:52 ` Tom Simons
2008-10-25 22:35 ` Rudolf Sykora
2008-10-25 23:02 ` Steve Simon
2008-10-26 8:57 ` John Stalker
2008-10-26 18:36 ` Eris Discordia
2008-10-27 4:55 ` Russ Cox
2008-10-27 8:28 ` Rudolf Sykora
2008-10-27 10:18 ` Charles Forsyth
2008-10-27 13:13 ` Eris Discordia
2008-10-27 13:23 ` erik quanstrom
2008-10-27 19:42 ` Eris Discordia
2008-10-27 16:13 ` Brian L. Stuart
2008-11-30 8:29 ` Yard Ape
2008-12-11 16:32 ` Rudolf Sykora
2008-10-24 18:02 ` John Stalker
2008-10-24 17:10 ` Uriel
2008-10-24 19:56 ` Charles Forsyth
2008-10-24 19:56 ` Rudolf Sykora
2008-10-26 21:23 ` Rob Pike
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=200810241127.m9OBRKGB004251@skeeve.com \
--to=arnold@skeeve.com \
--cc=9fans@9fans.net \
--cc=rudolf.sykora@gmail.com \
/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).