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

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

Re: Why are RegExps never working?


From: Johan Bockgård
Subject: Re: Why are RegExps never working?
Date: Fri, 16 Nov 2007 11:17:23 +0100
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.50 (gnu/linux)

Tim X <timx@nospam.dev.null> writes:

> bojohan+news@dd.chalmers.se (Johan Bockgård) writes:
>
>> Giorgos Keramidas <keramida@ceid.upatras.gr> writes:
>>
>>> There's a minor 'catch' here, which may prove interesting.  The
>>> `character-classes' supported by the regexp engine of Emacs
>>> consider the end of a line a [[:space:]] character
>>
>> There are several modes where this is not true, including Lisp and C. In
>> these modes newlines have `endcomment' syntax.
>
> isn't this controlled by the syntax table?

Yes.

> As you can modify the syntax table, you can modify how such things
> work. I seem to remember seeing a bit of elisp that did this to make
> the regexp easier to write when needing to do re-search. from memory,
> I think it temporarily changed the newline syntax entry in the local
> syntax table, performed the search and since this was all done within
> a saved context, everything is restored afterwards.

(with-syntax-table (copy-syntax-table ...)
  (modify-syntax-entry ...))

-- 
Johan Bockgård


reply via email to

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