From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: tomas@tuxteam.de Newsgroups: gmane.emacs.help Subject: Re: Help with regexp Date: Sat, 5 Dec 2009 07:46:08 +0100 Message-ID: <20091205064608.GB11528@tomas> References: <87y6lmtnbx.fsf@galatea.local> <20091202051626.GA19970@tomas> <87pr6xnca1.fsf@fh-trier.de> <20091202071139.GA6313@tomas> <87ljhln66x.fsf@fh-trier.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; x-action=pgp-signed Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1259996123 8717 80.91.229.12 (5 Dec 2009 06:55:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 5 Dec 2009 06:55:23 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Andreas Politz Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Dec 05 07:55:16 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NGoXy-0001As-Cl for geh-help-gnu-emacs@m.gmane.org; Sat, 05 Dec 2009 07:55:14 +0100 Original-Received: from localhost ([127.0.0.1]:50028 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGoXx-0005yn-R0 for geh-help-gnu-emacs@m.gmane.org; Sat, 05 Dec 2009 01:55:13 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NGoUz-0004NC-3w for help-gnu-emacs@gnu.org; Sat, 05 Dec 2009 01:52:09 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NGoUt-0004Je-QQ for help-gnu-emacs@gnu.org; Sat, 05 Dec 2009 01:52:07 -0500 Original-Received: from [199.232.76.173] (port=40501 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGoUt-0004JN-Fc for help-gnu-emacs@gnu.org; Sat, 05 Dec 2009 01:52:03 -0500 Original-Received: from alextrapp1.equinoxe.de ([217.22.192.104]:53103 helo=www.elogos.de) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NGoUs-0004mT-Us for help-gnu-emacs@gnu.org; Sat, 05 Dec 2009 01:52:03 -0500 Original-Received: by www.elogos.de (Postfix, from userid 1000) id 5D70090048; Sat, 5 Dec 2009 07:46:08 +0100 (CET) Content-Disposition: inline In-Reply-To: <87ljhln66x.fsf@fh-trier.de> User-Agent: Mutt/1.5.15+20070412 (2007-04-11) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:70422 Archived-At: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Wed, Dec 02, 2009 at 09:14:30AM +0100, Andreas Politz wrote: > tomas@tuxteam.de writes: >=20 > > On Wed, Dec 02, 2009 at 07:03:02AM +0100, Andreas Politz wrote: [...] > > Mind you, I don't like it either, but any idea I had kills some aspec= t > > of Simplicity we all appreciate in Emacs :-( > > > I am glad there isn't a third kind. What about the idea of getting rid > of them ? Some ideas : >=20 > - a new family of regexp functions ([+]backwards compatibility) I'm not sure this is needed. The functions themselves look fine to me. > - a 2nd string syntax w/o escapes ([+]should not need new data-type) Hm I was thinking about that too. But how would you represent e.g. a tab in this new syntax? > - a flag in the re to signal backslasheritis frailty > (\v in vim, [-]backwards compatibility) I see (didn't know about this one). > What kind of simplicity are you referring to ? Well -- now, to express a regular expression we just need a normal string. To do all this magic we'd first have to hook into the reader before it gets hold of the string. Common Lisp has such a facility (you can define a new reader syntax, which is very cool), but it pays some price for this flexibility. Emacs has taken the conscious decision not to go this route. > >> - no short aliases for important constructs : > >> digits,symbol-constituents,newline,space > > > > Well, you always have those pesky [:stuff:] ones. They ain't so tidy, > > but once you get used to them they are even more readable (and they > > reduce the backslash density considerably). >=20 > That sounds pretty weak. I would prefer \d over [[:digit:]] and [0-9] = . I miss that sometimes too :-) > >> - no zero-width matches ; look(ahead|behind) > > > > Hm. To be fair, there are some, among others \b, \B, \<, \> (and the > > funky \=3D, which matches at point). Yor are looking for a general ze= ro > > width match? >=20 > True. No, I was mostly thinking of look ahead/behind kind of context > matching. To be fair, I already saw a patch on emacs.dev, I believe, > for this. =20 Well, I see your points, but am torn. Simplicity, you know :-) (Now having PEGs as an alternative to regexps would be quite exciting :) Regards - -- tom=C3=A1s -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFLGgGwBcgs9XrR2kYRAgNyAJ0WnVxJc94YYyA2gozoGhmKt3mwfwCffApd ERlCyw8tri/9Qa8BPJZO/8g=3D =3Dyyn6 -----END PGP SIGNATURE-----