From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jari Aalto Newsgroups: gmane.emacs.devel Subject: Re: using non-Emacs regexp syntax Date: 29 Nov 2006 22:53:22 +0200 Message-ID: <877ixenfel.fsf@w2kpicasso.cante.net> References: <85odqqdv5p.fsf@lola.goethe.zz> <200611292113.19747.pogonyshev@gmx.net> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1164833745 9630 80.91.229.2 (29 Nov 2006 20:55:45 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 29 Nov 2006 20:55:45 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Nov 29 21:55:43 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GpWSu-0003Nm-3a for ged-emacs-devel@m.gmane.org; Wed, 29 Nov 2006 21:55:36 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GpWSt-0002st-Mf for ged-emacs-devel@m.gmane.org; Wed, 29 Nov 2006 15:55:35 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GpWSN-0002Wj-Rz for emacs-devel@gnu.org; Wed, 29 Nov 2006 15:55:03 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GpWSM-0002VY-RZ for emacs-devel@gnu.org; Wed, 29 Nov 2006 15:55:03 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GpWSM-0002VI-KL for emacs-devel@gnu.org; Wed, 29 Nov 2006 15:55:02 -0500 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1GpWSL-0003um-PU for emacs-devel@gnu.org; Wed, 29 Nov 2006 15:55:02 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1GpWRv-00037E-4h for emacs-devel@gnu.org; Wed, 29 Nov 2006 21:54:35 +0100 Original-Received: from a81-197-175-198.elisa-laajakaista.fi ([81.197.175.198]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 29 Nov 2006 21:54:35 +0100 Original-Received: from jari.aalto by a81-197-175-198.elisa-laajakaista.fi with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 29 Nov 2006 21:54:35 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Lines: 46 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: a81-197-175-198.elisa-laajakaista.fi User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:63079 Archived-At: Paul Pogonyshev writes: > David Kastrup wrote: > > "Drew Adams" 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