From: Jari Aalto <jari.aalto@cante.net>
Subject: Re: using non-Emacs regexp syntax
Date: 29 Nov 2006 22:53:22 +0200 [thread overview]
Message-ID: <877ixenfel.fsf@w2kpicasso.cante.net> (raw)
In-Reply-To: 200611292113.19747.pogonyshev@gmx.net
Paul Pogonyshev <pogonyshev@gmx.net> writes:
> David Kastrup wrote:
> > "Drew Adams" <drew.adams@oracle.com> writes:
> >
> > >> Is there a function to convert non-Emacs regexps (e.g. "ab(c+|d)" to
> > >> Emacs regexps (example to "ab\(c+\|d\)")?
> > >>
> > >> The first form appears to be an "extended regexp" or egrep-style regexp.
> > >> The second appears to be a "basic regexp" or grep-style regexp.
> > >>
> > >> This conversion feature in Lisp would be useful to add after the release.
> > >
> > > Very glad to hear that.
> > >
> > > I'm hoping there will also be support for toggling the newline sensitivity
> > > of dot. This means a "doc-matches-newline" mode (aka "single-line" mode)
> > > where `.' will also match newline. Please see the thread "short regexp to
> > > match any character?" from 2006/03/04 and 03/11.
> >
> > I don't know any other matcher where dot matches a newline. Quite
> > more relevant would be inverse character ranges like [^A-Z] that do
> > _not_ match newline by default.
>
> As far as I remember, Perl regexp syntax has a flag to match or not match
> newline by default.
Yes, it. It goes like this:
"This\nLine"
/.*/ "This"
/.*/s Make dot to match (m)ultiline: "This\nLine"
Common modifiers used are:
i Case (i)nsensitive match.
g (g)lobal match; all occurrances until last one
m (m)ultiline achors. The ^ and $ match in between the
lines, not just at the beginning or end of string.
s Change semantics of "." to also match \r or \n.
x e(x)tended. Treat all white space in regexp
non-significant. Makes it possible to wrire readable
regular expressions /Like \s This/
Jari
next prev parent reply other threads:[~2006-11-29 20:53 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-28 20:56 using non-Emacs regexp syntax Paul Pogonyshev
2006-11-29 16:26 ` Richard Stallman
2006-11-29 16:38 ` Drew Adams
2006-11-29 17:23 ` David Kastrup
2006-11-29 19:13 ` Paul Pogonyshev
2006-11-29 20:53 ` Jari Aalto [this message]
2006-11-30 2:11 ` Drew Adams
2006-11-30 14:26 ` Stefan Monnier
2006-12-05 5:16 ` Drew Adams
2006-12-01 20:30 ` Stuart D. Herring
2006-11-29 19:06 ` Paul Pogonyshev
-- strict thread matches above, loose matches on Subject: below --
2006-12-01 22:35 Stuart D. Herring
2006-12-01 22:54 ` Paul Pogonyshev
2006-12-03 20:22 ` Juri Linkov
2006-12-02 2:38 ` Stefan Monnier
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=877ixenfel.fsf@w2kpicasso.cante.net \
--to=jari.aalto@cante.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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.