* How to highlight the matching reqular expression strings
@ 2009-03-17 4:29 Anand Dhanakshirur
2009-03-17 6:15 ` thierry.volpiatto
0 siblings, 1 reply; 3+ messages in thread
From: Anand Dhanakshirur @ 2009-03-17 4:29 UTC (permalink / raw)
To: emacs help
Hi Bastien,
Thanks,
It worked for regexp like als.bd(any character).
It highlighted the matching strings.
But it did not work for als*bd(mutliple characters).
It did not highlight the matching strings.
How to do this?
Do
Bastien wrote:
> Anand Dhanakshirur <asd@cdotb.ernet.in> writes:
>
>
>> Kindly tell me How to do regular expression seach in emacs buffer.
>> for ex: i want to know(highlight) the all the text which are als*.
>>
>
> C-u C-s a l s *
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to highlight the matching reqular expression strings
2009-03-17 4:29 Anand Dhanakshirur
@ 2009-03-17 6:15 ` thierry.volpiatto
0 siblings, 0 replies; 3+ messages in thread
From: thierry.volpiatto @ 2009-03-17 6:15 UTC (permalink / raw)
To: help-gnu-emacs
Hi,
Anand Dhanakshirur <asd@cdotb.ernet.in> writes:
> Hi Bastien,
> Thanks,
> It worked for regexp like als.bd(any character).
> It highlighted the matching strings.
> But it did not work for als*bd(mutliple characters).
> It did not highlight the matching strings.
> How to do this?
May be you misunderstand the use of * here, that do not have the same
meaning that in shell like *.el.(globbing).
,----
| `*'
| is not a construct by itself; it is a postfix operator that means
| to match the preceding regular expression repetitively as many
| times as possible. Thus, `o*' matches any number of `o's
| (including no `o's).
|
| `*' always applies to the _smallest_ possible preceding
| expression. Thus, `fo*' has a repeating `o', not a repeating
| `fo'. It matches `f', `fo', `foo', and so on.
`----
Have a look at the elisp manual about regexps.
[eval - C-x C-e] ==> (info "(elisp)Regexp Special")
> Do
> Bastien wrote:
>> Anand Dhanakshirur <asd@cdotb.ernet.in> writes:
>>
>>
>>> Kindly tell me How to do regular expression seach in emacs buffer.
>>> for ex: i want to know(highlight) the all the text which are als*.
>>>
>>
>> C-u C-s a l s *
>>
>>
>
>
>
>
--
A + Thierry Volpiatto
Location: Saint-Cyr-Sur-Mer - France
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to highlight the matching reqular expression strings
[not found] <mailman.3363.1237263608.31690.help-gnu-emacs@gnu.org>
@ 2009-03-17 8:55 ` Giorgos Keramidas
0 siblings, 0 replies; 3+ messages in thread
From: Giorgos Keramidas @ 2009-03-17 8:55 UTC (permalink / raw)
To: help-gnu-emacs
On Tue, 17 Mar 2009 09:59:27 +0530, Anand Dhanakshirur <asd@cdotb.ernet.in> wrote:
>>> Kindly tell me How to do regular expression seach in emacs buffer.
>>> for ex: i want to know(highlight) the all the text which are als*.
>>>
>>
>> C-u C-s a l s *
>
> Hi Bastien,
> Thanks,
> It worked for regexp like als.bd(any character).
> It highlighted the matching strings.
> But it did not work for als*bd(mutliple characters).
> It did not highlight the matching strings.
> How to do this?
The '*' character has a special meaning in reguar expressions. It means
`zero or more occurences of the last regular expression part'. So, when
you try to highlight `als*bd' it will match with `albd', `alsbd', and
`alssbd' but not with `als?bd' where '?' is any other character than 's'.
Try running `M-x highlight-regexp RET als.*bd RET' The extra '.' before
the special '*' character means `any character', so this will match text
like `alsbd', `alsabd', `alsbbd', ..., `alsaabd', `alsabbd', `alsacbd',
and so on.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-03-17 8:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.3363.1237263608.31690.help-gnu-emacs@gnu.org>
2009-03-17 8:55 ` How to highlight the matching reqular expression strings Giorgos Keramidas
2009-03-17 4:29 Anand Dhanakshirur
2009-03-17 6:15 ` thierry.volpiatto
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).