> On 26 juin, 14:17, Daniele Futtorovic <da.futt.n...@laposte.net>
> wrote:
[quoted text clipped - 27 lines]
> So, i have a file with regexp \0, instead of change the file, i test
> and replace all \0 found in the file with \00.
Come to think of it, I don't believe I'm right.
You didn't answer my question as to how you read the file's content, but
I cannot imagine any text reader actually thus interpreting the two
chars "\" and "0".
No, what's much more likely the explanation, IMO, is that the octal
notation is defined, roughly, as "any number, preceded by '\0'". In your
case, the number would be "". But that's NaN.
So, I think your assumption that "\0", as a regexp, ought to match the
NULL char is wrong. It'd match the char "0" (needlessly quoted), or it
may be interpreted as a backreference (not too sure), but it wouldn't
match the NULL character, and it seems to me as though this might be
called "working as designed" (and documented).
You said:
> 2) If i defines directly the regexp \0 in java code, the regexp MATCH.
Yes, that is, if you define the regex using "\0", as opposed to "\\0".
The "\0" gets interpreted by -- I don't know if its the compiler, just
like "\\" gets interpreted to "\". So in the end (the runtime), in your
regex pattern, there /is/ the character NULL, not a backslash and a
zero. But when you load the pattern String from a file, it transcedes
into the regex pattern /as is/.