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 15:05:28 -0700 [thread overview]
Message-ID: <AANLkTinb1QWHxnEpKebLw69-mvWtK-Rqi4zoVnO_YJ7x@mail.gmail.com> (raw)
In-Reply-To: <4D813140.6090402@mousecar.com>
On Wed, Mar 16, 2011 at 2:53 PM, ken <gebser@mousecar.com> wrote:
> On 03/16/2011 03:40 PM PJ Weisberg wrote:
>> 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"
>
> That's almost it, but not quite. It grabs only the on last character
> before the "B"; in my example above it grabs just "f". I'm needing to grab:
>
> "Any Text-- <a name="thisname">
> Hot Stuff"
>
> -- without the quotes, of course.
Well, it *matches* the whole thing; it's just that the parentheses
only grab the last character. Put in another set of parentheses
around the part you want to capture, and you're golden.
"<h3>\\(\\(.\\|\n\\)*?\\)</h3"
-PJ
next prev parent reply other threads:[~2011-03-16 22:05 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
2011-03-16 21:53 ` ken
2011-03-16 22:05 ` PJ Weisberg [this message]
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=AANLkTinb1QWHxnEpKebLw69-mvWtK-Rqi4zoVnO_YJ7x@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.