From: Martin Stone Davis <m0davis@pacbell.net>
Subject: Re: rx vs sregex - a "match" to the death
Date: Sun, 05 Oct 2003 10:08:08 -0700 [thread overview]
Message-ID: <blpj5p$a5o$1@sea.gmane.org> (raw)
In-Reply-To: <usmm71yf4.fsf@ID-87814.user.dfncis.de>
Oliver Scholz wrote:
> Martin Stone Davis <m0davis@pacbell.net> writes:
>
>
>>Who likes `rx'?
>>Who likes `sregex'?
>>Who likes `rx' more than `sregex'?
>>Who likes `sregex' more than `rx'?
>>Why?
>
>
>>From the commentary section of rx.el:
>
> This is another implementation of sexp-form regular expressions.
> It was unfortunately written without being aware of the Sregex
> package coming with Emacs, but as things stand, Rx completely
> covers all regexp features, which Sregex doesn't, doesn't suffer
> from the bugs mentioned in the commentary section of Sregex, and
> uses a nicer syntax (IMHO, of course :-).
>
> Personally I don't know about the nicer syntax, because I never tried
> sregex. For the very reason that I discovered rx first.
>
> Oliver
Thanks for pointing that out. I should have thought to read there.
While I was comparing the two functions, I could not find if/how rx
handles numbered backreferences. It's done in sregex like this:
;; (sregexq (group (or "Go" "Run"))
;; ", Spot, "
;; (backref 1)) => "\\(Go\\|Run\\), Spot, \\1"
How do you do the same using rx?
I should also mention that sregex does not try to optimize `or'
constructs. rx automatically runs regexp-opt on any (or ...) it sees.
-Martin
next prev parent reply other threads:[~2003-10-05 17:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.1134.1065355880.21628.help-gnu-emacs@gnu.org>
2003-10-05 15:45 ` rx vs sregex - a "match" to the death Oliver Scholz
2003-10-05 17:08 ` Martin Stone Davis [this message]
[not found] ` <mailman.1139.1065373803.21628.help-gnu-emacs@gnu.org>
2003-10-06 7:25 ` Oliver Scholz
2003-10-06 8:41 ` Martin Stone Davis
[not found] ` <mailman.1154.1065429721.21628.help-gnu-emacs@gnu.org>
2003-10-06 8:55 ` Oliver Scholz
2003-10-05 12:07 Martin Stone Davis
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='blpj5p$a5o$1@sea.gmane.org' \
--to=m0davis@pacbell.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 read-only IMAP folder(s) and NNTP newsgroup(s).