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: Sven Bretfeld
Subject: Re: Why are RegExps never working?
Date: Wed, 14 Nov 2007 00:51:27 +0100
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.1.50 (gnu/linux)

Hi Peter and Giorgos

Giorgos Keramidas <keramida@ceid.upatras.gr> writes:

> On 2007-11-13 16:49, Peter Dyballa <Peter_Dyballa@Web.DE> wrote:
>>
>> Am 13.11.2007 um 00:53 schrieb Giorgos Keramidas:
>>
>>>     \([[:space:]][pP][pP]\.\)[[:space:]]+\([0-9]+\) -> \1~\2
>>
>> Did you try it? For me it does correct Sven's example, which is this:
>>
>>      text pp. 44 text text text text text text text text pp.
>>      54 text
>>
>> It would work when the from part would not stretch over more than one line.
>
> I did.
>
> I used an Emacs snapshot from CVS, but I have this sort of regexp in my
> ~/NOTES file for several years.  The last time I updated the note was on
> May 15, 2004.  It is strange that it doesn't work there.
>
> I just tried once more, by running:
>
>     emacs -q -nw
>
> Then I pasted in a text-mode buffer the text:
>
>     text pp. 44 text text text text text text text text pp.
>     54 text
>
> and after replacing the regexp shown above, my buffer now contains:
>
>     text pp.~44 text text text text text text text text pp.~54 text
>
> Odd, indeed...

It's partly working. But not with all major modes. It's working in a
Fundamental buffer, but neither in the *scratch* nor in an AucTeX
buffer. How Emacs is started doesn't seem to matter. That disturbs me.
Line endings should be \n in every mode, aren't they?

The info node Char Classes says:

`[:space:]'
     This matches any character that has whitespace syntax (*note
     Syntax Class Table::).

While a whitespace character is described thus:

 -- Syntax class: whitespace character
     "Whitespace characters" (designated by ` ' or `-') separate
     symbols and words from each other.  Typically, whitespace
     characters have no other syntactic significance, and multiple
     whitespace characters are syntactically equivalent to a single
     one.  Space, tab, newline and formfeed are classified as
     whitespace in almost all major modes.
                ^^^^^^^^^^^^^^^^^^^^^^^^^

Obviously not in the LaTeX major mode. It's a pity. Would have been a
nice shortcut.

Greetings

Sven

Attachment: pgpQh_PCchRcz.pgp
Description: PGP signature


reply via email to

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