From: ken <gebser@mousecar.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: string searching and saving results to a variable
Date: Wed, 16 Feb 2011 11:58:53 -0500 [thread overview]
Message-ID: <4D5C024D.1050406@mousecar.com> (raw)
In-Reply-To: <ijg4uk$68m$1@dough.gmane.org>
On 02/16/2011 04:21 AM Oleksandr Gavenko wrote:
> On 16.02.2011 8:55, ken wrote:
>> I'm guessing it could then be done more elispishly as
>>
>> (setq dog (buffer-substring
>> (re-search-backward "<h1\\|<h2\\|<h3\\|<h4\\|<h5" nil t)
>> (re-search-forward "</h1>\\|</h2>\\|</h3>\\|</h4>\\|</h5>" nil t)))
>>
> How about if search fail?
>
> Evaluating of
>
> (buffer-substring nil nil)
>
> take (wrong-type-argument integer-or-marker-p nil).
Error-checking is an excellent idea, I agree. But I don't understand
the elisp code you wrote. Could you explain it for me please.
Thanks.
next prev parent reply other threads:[~2011-02-16 16:58 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-15 23:15 string searching and saving results to a variable ken
2011-02-15 23:33 ` Perry Smith
2011-02-16 6:55 ` ken
2011-02-16 9:21 ` Oleksandr Gavenko
2011-02-16 16:58 ` ken [this message]
2011-02-19 11:16 ` Oleksandr Gavenko
2011-02-16 11:28 ` Le Wang
2011-02-17 10:51 ` ken
2011-02-17 13:30 ` Perry Smith
2011-02-18 17:33 ` ken
2011-02-18 18:16 ` Le Wang
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D5C024D.1050406@mousecar.com \
--to=gebser@mousecar.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).