unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Le Wang <l26wang@gmail.com>
To: gebser@mousecar.com
Cc: GNU Emacs List <help-gnu-emacs@gnu.org>
Subject: Re: string searching and saving results to a variable
Date: Wed, 16 Feb 2011 19:28:58 +0800	[thread overview]
Message-ID: <AANLkTimtn0cLykaaCPLMsxTiNmO=VJi2TY9HBfHNsf1E@mail.gmail.com> (raw)
In-Reply-To: <4D5B74FC.80204@mousecar.com>

[-- Attachment #1: Type: text/plain, Size: 602 bytes --]

On Wed, Feb 16, 2011 at 2:55 PM, ken <gebser@mousecar.com> wrote:

> (setq dog (buffer-substring
>   (re-search-backward "<h1\\|<h2\\|<h3\\|<h4\\|<h5" nil t)
>   (re-search-forward "</h1>\\|</h2>\\|</h3>\\|</h4>\\|</h5>" nil t)))
>

What mode are you using to edit html?  What version of Emacs?  It's likely
your major-mode supports balanced tag movements, so this hacky regexp
searching isn't necessary.

What do you want o do with the saved text?  Why don't you try to compose the
function to the best of your ability, and I'm sure someone will give you
hints for what you can't get working.

-- 
Le

[-- Attachment #2: Type: text/html, Size: 1041 bytes --]

  parent reply	other threads:[~2011-02-16 11:28 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
2011-02-19 11:16         ` Oleksandr Gavenko
2011-02-16 11:28     ` Le Wang [this message]
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='AANLkTimtn0cLykaaCPLMsxTiNmO=VJi2TY9HBfHNsf1E@mail.gmail.com' \
    --to=l26wang@gmail.com \
    --cc=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).