emacs-devel
[Top][All Lists]
Advanced

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

Re: utf-16le vs utf-16-le


From: Stefan Monnier
Subject: Re: utf-16le vs utf-16-le
Date: Tue, 15 Apr 2008 11:35:30 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

>>>> You mean, it's almost exactly the same, except it's completely
>>>> different?  Then I agree,
>> 
>>> "Start/end of line" and "Start of buffer/communication" is not
>>> "completely different".  Likewise, "\\`" and "^" are not "completely
>>> different" regular expressions.
>> 
>> But by EOL we don't mean "^" or "$", but "\n": this *is* completely
>> different from "\\`".

> I fail to see anything close to a coherent argument here, and it is
> probably not relevant to the issue at hand, anyway.  So we might as well
> stop.

Look at the src/regex.c code (or any other regex manipulation code);
compare the code needed for "^" and "$" to the code needed for "\n".
"\n" is trivial, just like any other char (which is the key here:
EOL-conversion is just a way to convert the \n to a byte sequence and
vice-versa, which is why it integrates well with EOL-conversion),
whereas ^ and $ require special handling because they have to look
before or after the matched text.

Try (replace-regexp-in-string "\\>" "toto" "a b c") to get a feeling for
the kinds of problems you can get with regexp elements that look outside
of the matched text.


        Stefan




reply via email to

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