From: PJ Weisberg <pjweisberg@gmail.com>
To: gebser@mousecar.com
Cc: GNU Emacs List <help-gnu-emacs@gnu.org>
Subject: Re: RE for any text, including white space
Date: Wed, 16 Mar 2011 12:40:22 -0700 [thread overview]
Message-ID: <AANLkTin_F9DRPXzbTUgNnm3xWWB_heyP1RJ3S26t_iHc@mail.gmail.com> (raw)
In-Reply-To: <4D80B9BE.2070105@mousecar.com>
On 3/16/11, ken <gebser@mousecar.com> wrote:
> What's the RE for any text, white space included? I also want to grab
> (for match-string...) this text. The text is bounded by known
> characters. E.g.,
>
> <h3>Any Text-- <a name="thisname">
> Hot Stuff</h3
>>
>
> In the above, how to grab the text of the title, i.e., everything
> between <h3> and </h3>? Conceivably this title text might contain
> *anything* except "</[Hh]{1-9]".
>
If A and B are your start and end points, then you want:
"A\\(.\\|\n\\)*?B"
You probably got thrown off by the fact that '.' matches anything
EXCEPT a newline. Regexps are usually assumed to be line-based.
The '?' is there to make the '*' non-greedy, to prevent it from
matching everything between the first A and the last B in the whole
buffer.
The double '\'s are necessary in lisp code because it's interpreted as
a string before it's passed to the regexp engine.
-PJ
next prev parent reply other threads:[~2011-03-16 19:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-16 13:23 RE for any text, including white space ken
2011-03-16 19:40 ` PJ Weisberg [this message]
2011-03-16 21:53 ` ken
2011-03-16 22:05 ` PJ Weisberg
2011-03-16 23:43 ` ken
2011-03-17 4:50 ` Kevin Rodgers
2011-03-17 10:20 ` ken
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=AANLkTin_F9DRPXzbTUgNnm3xWWB_heyP1RJ3S26t_iHc@mail.gmail.com \
--to=pjweisberg@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.
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.