Gnus development mailing list
 help / color / mirror / Atom feed
From: Lloyd Zusman <ljz@asfast.com>
Subject: Regular expression converter.
Date: Sun, 09 Nov 2003 14:45:45 -0500	[thread overview]
Message-ID: <m3k769l40m.fsf@asfast.com> (raw)

Before I re-invent the wheel ...

Has anyone here written or obtained an elisp function or macro that will
convert perl-like regular expressions into Emacs regexp's?

I know this isn't strictly a Gnus question, but I have a feeling that
someone here might already be using something like this.

As an example, this proposed function/macro would convert the expression
marked as "Perl" to the one marked "Emacs" (note that I'm writing these
as if they would appear inside of an Elisp string, and therefore, the
backslashes are all doubled):

  Perl:   ^(.+?\\.)+(com|net|org)$
  Emacs:  ^\\(.+?\\.\\)+\\(com\\|net\\|org\\)$

If the input contains any perl-isms that can't be converted to an
appropriate Emacs regexp construct, I don't mind if this function fails.
My main goal is to use a regular expression syntax with fewer
backslashes in my elisp code, in order to aid readablility and speed up
debugging.

Thanks in advance.

-- 
 Lloyd Zusman
 ljz@asfast.com



             reply	other threads:[~2003-11-09 19:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-09 19:45 Lloyd Zusman [this message]
2003-11-09 19:58 ` Jesper Harder
2003-11-09 22:56   ` Lloyd Zusman
2003-11-10  0:23 ` Lloyd Zusman

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=m3k769l40m.fsf@asfast.com \
    --to=ljz@asfast.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).