From: tomas@tuxteam.de
To: David Combs <dkcombs@panix.com>
Cc: help-gnu-emacs@gnu.org
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 [thread overview]
Message-ID: <20091017060138.GA28751@tomas> (raw)
In-Reply-To: <hba9u8$99n$1@panix1.panix.com>
-----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") ,
>
> But here's what I get back:
>
>
> 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") nil)
> call-interactively(eval-expression)
> recursive-edit()
> byte-code(" \x10 @ = !
>
>
> 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_100001pilotmon.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ás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFK2V3CBcgs9XrR2kYRAmmoAJ0cvr24IBhvCzguoaA/9+WUKF8J2wCfcSXx
dtll6FwQmTTwWEP5IWul5VQ=
=uRL7
-----END PGP SIGNATURE-----
next prev parent reply other threads:[~2009-10-17 6:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-16 17:19 How to check regexp for syntax-errors? (There HAS to be SOME way, yes?) David Combs
2009-10-16 17:39 ` rustom
2009-10-16 18:24 ` Joost Kremers
2009-10-16 22:55 ` Andreas Politz
2009-10-17 6:01 ` tomas [this message]
2009-10-20 7:54 ` Kevin Rodgers
-- strict thread matches above, loose matches on Subject: below --
2009-10-20 12:05 martin rudalics
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=20091017060138.GA28751@tomas \
--to=tomas@tuxteam.de \
--cc=dkcombs@panix.com \
--cc=help-gnu-emacs@gnu.org \
/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.