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: How to check regexp for syntax-errors? (There HAS to be SOME way, yes?) Date: Sat, 17 Oct 2009 08:01:38 +0200 Message-ID: <20091017060138.GA28751@tomas> References: 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 1255759208 4259 80.91.229.12 (17 Oct 2009 06:00:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 17 Oct 2009 06:00:08 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: David Combs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Oct 17 07:59:57 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 1Mz2Kb-0005q9-CR for geh-help-gnu-emacs@m.gmane.org; Sat, 17 Oct 2009 07:59:57 +0200 Original-Received: from localhost ([127.0.0.1]:59838 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mz2Ka-0003BP-Ji for geh-help-gnu-emacs@m.gmane.org; Sat, 17 Oct 2009 01:59:56 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mz2K3-0003BC-WE for help-gnu-emacs@gnu.org; Sat, 17 Oct 2009 01:59:24 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mz2Jy-0003Ak-6w for help-gnu-emacs@gnu.org; Sat, 17 Oct 2009 01:59:22 -0400 Original-Received: from [199.232.76.173] (port=39910 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mz2Jy-0003Ah-2B for help-gnu-emacs@gnu.org; Sat, 17 Oct 2009 01:59:18 -0400 Original-Received: from alextrapp1.equinoxe.de ([217.22.192.104]:42270 helo=www.elogos.de) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mz2Jx-0006pS-FS for help-gnu-emacs@gnu.org; Sat, 17 Oct 2009 01:59:17 -0400 Original-Received: by www.elogos.de (Postfix, from userid 1000) id D1AC690008; Sat, 17 Oct 2009 08:01:38 +0200 (CEST) Content-Disposition: inline In-Reply-To: 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:69052 Archived-At: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Fri, Oct 16, 2009 at 01:19:04PM -0400, David Combs wrote: > Trying to get this to work: [...] As Andreas already noted, your (primary) problem here isn't with the regexp. There just isn't a function named "Occur". I guess it's "occur" you are after: > (Occur "\\([0-9][0-9]\\)\\([0-9][0-9]\\)\\([0-9][0-9]\\)_\\([0-9][0-9][0-= 9][0-9][0-9][0-9]\\)1\\([a-zA-Z\\][0-9a-zA-Z]*\\).mp3") , >=20 > But here's what I get back: >=20 >=20 > Debugger entered--Lisp error: (void-function Occur) this is the clue ^^^^^^^^^^^^^^^^^^^ > (Occur "\\([0-9][0-9]\\)\\([0-9][0-9]\\)\\([0-9][0-9]\\)_\\([0-9][0-9][= 0-9][0-9][0-9][0-9]\\)1\\([a-zA-Z\\][0-9a-zA-Z]*\\).mp3") > eval((Occur "\\([0-9][0-9]\\)\\([0-9][0-9]\\)\\([0-9][0-9]\\)_\\([0-9][= 0-9][0-9][0-9][0-9][0-9]\\)1\\([a-zA-Z\\][0-9a-zA-Z]*\\).mp3")) > eval-expression((Occur "\\([0-9][0-9]\\)\\([0-9][0-9]\\)\\([0-9][0-9]\\= )_\\([0-9][0-9][0-9][0-9][0-9][0-9]\\)1\\([a-zA-Z\\][0-9a-zA-Z]*\\).mp3") n= il) > call-interactively(eval-expression) > recursive-edit() > byte-code(" =10 @ =3D ! >=20 >=20 > Which is completely "Greek" to me! Understandable :-) Emacs tries to be helpful showing you the "call stack", i.e. from where the statement was called which gave it hiccups. As to the regexp... "\\([0-9][0-9]\\)\\([0-9][0-9]\\)\\([0-9][0-9]\\)_\\([0-9][0-9][0-9][0-9= ][0-9][0-9]\\)1\\([a-zA-Z\\][0-9a-zA-Z]*\\).mp3" it is syntaactically fine as it is, but won't match your data: -rw-rw-rw- 1 David root 10895733 10-16 09:51 091005_100001p= ilotmon.MP3 at least for several reasons: - the ".mp3" at the end is lowercase in the regexp, upercase in your data. - this long string of [0-9] with which you are trying to match the 100001 in the example above _already_ matches all six digits -- thus the "1" after the parenthesis in the regexp turns out empty-handed. - I don't know whether the construct near the end: [a-zA-Z\\][0-9a-zA-Z]* is really doing what you think it should (it looks to me a bit like you wanted to say: [a-zA-Z][0-9a-zA-Z]* i.e. "one character and zero or more characters or digits") > Isn't there some .el that that will try to parse a regexp, and tell > me where it got confused, and what to look for for errors? Others have answered this question in the thread. Regards - -- tom=C3=A1s -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFK2V3CBcgs9XrR2kYRAmmoAJ0cvr24IBhvCzguoaA/9+WUKF8J2wCfcSXx dtll6FwQmTTwWEP5IWul5VQ=3D =3DuRL7 -----END PGP SIGNATURE-----