* How to re-search for ^"*Nanotechnology*"$
@ 2007-09-05 12:32 Mirko
2007-09-05 13:02 ` Mirko
` (4 more replies)
0 siblings, 5 replies; 9+ messages in thread
From: Mirko @ 2007-09-05 12:32 UTC (permalink / raw)
To: help-gnu-emacs
Hello,
how does one write the regular expression search (in elisp) to look
for
^"*Nanotechnology*"$
(The string is inclosed by *'s and these are the only characters on
the line.
My attempt
(re-search-forward "\*[a-zA-Z ]+\*")
fails.
Also, if you could (please) show me how to use the [:alpha:]
construct.
Thank you very much.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to re-search for ^"*Nanotechnology*"$
2007-09-05 12:32 How to re-search for ^"*Nanotechnology*"$ Mirko
@ 2007-09-05 13:02 ` Mirko
2007-09-05 13:13 ` Daniel Jensen
` (3 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Mirko @ 2007-09-05 13:02 UTC (permalink / raw)
To: help-gnu-emacs
On Sep 5, 8:32 am, Mirko <mvuko...@nycap.rr.com> wrote:
> Hello,
>
> how does one write the regular expression search (in elisp) to look
> for
> ^"*Nanotechnology*"$
>
> (The string is inclosed by *'s and these are the only characters on
> the line.
>
> My attempt
> (re-search-forward "\*[a-zA-Z ]+\*")
> fails.
>
> Also, if you could (please) show me how to use the [:alpha:]
> construct.
>
> Thank you very much.
To clarify, the above string is only an example. Instead of
Nanotechnology (which is a journal name),
it could be some other string enclosed by *'s.
Mirko
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to re-search for ^"*Nanotechnology*"$
2007-09-05 12:32 How to re-search for ^"*Nanotechnology*"$ Mirko
2007-09-05 13:02 ` Mirko
@ 2007-09-05 13:13 ` Daniel Jensen
2007-09-05 13:18 ` Mirko
2007-09-05 13:27 ` Stephen Berman
` (2 subsequent siblings)
4 siblings, 1 reply; 9+ messages in thread
From: Daniel Jensen @ 2007-09-05 13:13 UTC (permalink / raw)
To: help-gnu-emacs
Mirko <mvukovic@nycap.rr.com> writes:
> My attempt
> (re-search-forward "\*[a-zA-Z ]+\*")
> fails.
Remember to use double backslashes in regexp string literals. The
backslash is an escape character in strings, so you need to use "\\" to
embed a backslash character in the string.
Or you could use rx, which provides a symbolic regexp syntax:
(rx "*" (one-or-more (in alpha space)) "*")
Some find it easier to use.
> Also, if you could (please) show me how to use the [:alpha:]
> construct.
[[:alpha:]]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to re-search for ^"*Nanotechnology*"$
2007-09-05 13:13 ` Daniel Jensen
@ 2007-09-05 13:18 ` Mirko
0 siblings, 0 replies; 9+ messages in thread
From: Mirko @ 2007-09-05 13:18 UTC (permalink / raw)
To: help-gnu-emacs
On Sep 5, 9:13 am, dan...@bigwalter.net (Daniel Jensen) wrote:
> Mirko <mvuko...@nycap.rr.com> writes:
> > My attempt
> > (re-search-forward "\*[a-zA-Z ]+\*")
> > fails.
>
> Remember to use double backslashes in regexp string literals. The
> backslash is an escape character in strings, so you need to use "\\" to
> embed a backslash character in the string.
>
> Or you could use rx, which provides a symbolic regexp syntax:
>
> (rx "*" (one-or-more (in alpha space)) "*")
>
> Some find it easier to use.
>
> > Also, if you could (please) show me how to use the [:alpha:]
> > construct.
>
> [[:alpha:]]
Thank you Daniel.
I also made some progress. Most of the mistakes were mine (too
numerous and embarrassing to list here)
Mirko
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to re-search for ^"*Nanotechnology*"$
2007-09-05 12:32 How to re-search for ^"*Nanotechnology*"$ Mirko
2007-09-05 13:02 ` Mirko
2007-09-05 13:13 ` Daniel Jensen
@ 2007-09-05 13:27 ` Stephen Berman
2007-09-05 13:32 ` Eric Hanchrow
[not found] ` <mailman.366.1188999503.18990.help-gnu-emacs@gnu.org>
4 siblings, 0 replies; 9+ messages in thread
From: Stephen Berman @ 2007-09-05 13:27 UTC (permalink / raw)
To: help-gnu-emacs
On Wed, 05 Sep 2007 05:32:22 -0700 Mirko <mvukovic@nycap.rr.com> wrote:
> Hello,
>
> how does one write the regular expression search (in elisp) to look
> for
> ^"*Nanotechnology*"$
>
> (The string is inclosed by *'s and these are the only characters on
> the line.
>
> My attempt
> (re-search-forward "\*[a-zA-Z ]+\*")
> fails.
You need to escape the the backslashes for the Lisp reader to recognize
their use as an escape character in the regular expression:
(re-search-forward "^\\*[a-zA-Z ]+\\*$")
> Also, if you could (please) show me how to use the [:alpha:]
> construct.
(re-search-forward "^\\*[[:alpha:]]+\\*$")
Steve Berman
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to re-search for ^"*Nanotechnology*"$
2007-09-05 12:32 How to re-search for ^"*Nanotechnology*"$ Mirko
` (2 preceding siblings ...)
2007-09-05 13:27 ` Stephen Berman
@ 2007-09-05 13:32 ` Eric Hanchrow
[not found] ` <mailman.366.1188999503.18990.help-gnu-emacs@gnu.org>
4 siblings, 0 replies; 9+ messages in thread
From: Eric Hanchrow @ 2007-09-05 13:32 UTC (permalink / raw)
To: help-gnu-emacs
>>>>> "Mirko" == Mirko <mvukovic@nycap.rr.com> writes:
Mirko> Hello, how does one write the regular expression search (in
Mirko> elisp) to look for ^"*Nanotechnology*"$
(rx bos "*Nanotechnology*" eos)
--
Keaton, Chaplin, Garbo - let them now make room for Gromit.
A. O. Scott, in The New York Times
^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <mailman.366.1188999503.18990.help-gnu-emacs@gnu.org>]
* Re: How to re-search for ^"*Nanotechnology*"$
[not found] ` <mailman.366.1188999503.18990.help-gnu-emacs@gnu.org>
@ 2007-09-05 15:27 ` Mirko
2007-09-05 21:41 ` Eric Hanchrow
[not found] ` <mailman.387.1189029199.18990.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 9+ messages in thread
From: Mirko @ 2007-09-05 15:27 UTC (permalink / raw)
To: help-gnu-emacs
On Sep 5, 9:32 am, Eric Hanchrow <off...@blarg.net> wrote:
> >>>>> "Mirko" == Mirko <mvuko...@nycap.rr.com> writes:
>
> Mirko> Hello, how does one write the regular expression search (in
> Mirko> elisp) to look for ^"*Nanotechnology*"$
>
> (rx bos "*Nanotechnology*" eos)
>
> --
> Keaton, Chaplin, Garbo - let them now make room for Gromit.
> A. O. Scott, in The New York Times
Thank you very much to all. I am doing OK now without rx, but I will
take a look at it.
Mirko
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to re-search for ^"*Nanotechnology*"$
2007-09-05 15:27 ` Mirko
@ 2007-09-05 21:41 ` Eric Hanchrow
[not found] ` <mailman.387.1189029199.18990.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 9+ messages in thread
From: Eric Hanchrow @ 2007-09-05 21:41 UTC (permalink / raw)
To: help-gnu-emacs
>>>>> "Mirko" == Mirko <mvukovic@nycap.rr.com> writes:
Mirko> I am doing OK now without rx ...
You just _think_ you are.
Seriously, I think "rx" is one of the best little-known features of
Emacs; _almost_ any regular expression can be written _much_ more
clearly with it. One caveat, though, is that the version in Emacs 22
has lots more bells and whistles than the version in Emacs 21, so if
portability is important to you, limit yourself to the Emacs 21
features (which are _still_ a huge improvement over writing them
"raw").
--
Keaton, Chaplin, Garbo - let them now make room for Gromit.
A. O. Scott, in The New York Times
^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <mailman.387.1189029199.18990.help-gnu-emacs@gnu.org>]
* Re: How to re-search for ^"*Nanotechnology*"$
[not found] ` <mailman.387.1189029199.18990.help-gnu-emacs@gnu.org>
@ 2007-09-06 12:50 ` Mirko
0 siblings, 0 replies; 9+ messages in thread
From: Mirko @ 2007-09-06 12:50 UTC (permalink / raw)
To: help-gnu-emacs
On Sep 5, 5:41 pm, Eric Hanchrow <off...@blarg.net> wrote:
> >>>>> "Mirko" == Mirko <mvuko...@nycap.rr.com> writes:
>
> Mirko> I am doing OK now without rx ...
>
> You just _think_ you are.
>
> Seriously, I think "rx" is one of the best little-known features of
> Emacs; _almost_ any regular expression can be written _much_ more
> clearly with it. One caveat, though, is that the version in Emacs 22
> has lots more bells and whistles than the version in Emacs 21, so if
> portability is important to you, limit yourself to the Emacs 21
> features (which are _still_ a huge improvement over writing them
> "raw").
>
> --
> Keaton, Chaplin, Garbo - let them now make room for Gromit.
> A. O. Scott, in The New York Times
Well, what peaked my attention was the "_much_ more clearly" bit.I
will take a look at it then.
Mirko
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2007-09-06 12:50 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-05 12:32 How to re-search for ^"*Nanotechnology*"$ Mirko
2007-09-05 13:02 ` Mirko
2007-09-05 13:13 ` Daniel Jensen
2007-09-05 13:18 ` Mirko
2007-09-05 13:27 ` Stephen Berman
2007-09-05 13:32 ` Eric Hanchrow
[not found] ` <mailman.366.1188999503.18990.help-gnu-emacs@gnu.org>
2007-09-05 15:27 ` Mirko
2007-09-05 21:41 ` Eric Hanchrow
[not found] ` <mailman.387.1189029199.18990.help-gnu-emacs@gnu.org>
2007-09-06 12:50 ` Mirko
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.