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

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

Re: Why does this happen in regexp isearch?


From: Daniel Pittman
Subject: Re: Why does this happen in regexp isearch?
Date: Sat, 03 Jul 2010 23:14:59 +1000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Deniz Dogan <deniz.a.m.dogan@gmail.com> writes:

> I open cus-edit.el.gz in Emacs and do a regexp isearch for:
>
> ^  ;;
>
> (Beginning of line, then two spaces, then two semicolons.)
>
> For some reason that I don't understand, it seems to match "beginning
> of line, any number of spaces OR tabs, then two semicolons". When I
> search for:
>
> ^ \{2\};;
>
> ...it finds what I'm looking for. Why is this?

(defcustom search-whitespace-regexp (purecopy "\\s-+")
  "If non-nil, regular expression to match a sequence of whitespace chars.
This applies to regular expression incremental search.
When you put a space or spaces in the incremental regexp, it stands for
this, unless it is inside of a regexp construct such as [...] or *, + or ?.
You might want to use something like \"[ \\t\\r\\n]+\" instead.
In the Customization buffer, that is `[' followed by a space,
a tab, a carriage return (control-M), a newline, and `]+'.

When this is nil, each space you type matches literally, against one space."
  :type '(choice (const :tag "Find Spaces Literally" nil)
                 regexp)
  :group 'isearch)

Regards,
        Daniel
-- 
✣ Daniel Pittman            ✉ daniel@rimspace.net            ☎ +61 401 155 707
               ♽ made with 100 percent post-consumer electrons




reply via email to

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