help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to highlight the matching reqular expression strings


From: Giorgos Keramidas
Subject: Re: How to highlight the matching reqular expression strings
Date: Tue, 17 Mar 2009 10:55:29 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.91 (berkeley-unix)

On Tue, 17 Mar 2009 09:59:27 +0530, Anand Dhanakshirur <address@hidden> 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]