>Aah, thanks Gordon. My Perl background stood in the way.
>In Perl the EOL would be irrelevant.
>>In Perl the EOL would be irrelevant.
>
> It depends on the meaning of »the EOL would be irrelevant«.
No it does not. In the described problem the EOL is simply irrelevant.
print "12345" =~ /^.*$/ ? 1 : 0;
print "123\r\n" =~ /^.*$/ ? 1 : 0;
print "12345 " =~ /./ ? 1 : 0; # or even this
print "123\r\n" =~ /./ ? 1 : 0; #
prints 1111
Cheers,
Koos

Signature
43rd Law of Computing: Anything that can go wr
fortune: Segmentation violation -- Core dumped
Stefan Ram - 07 Apr 2006 18:03 GMT
>>>In Perl the EOL would be irrelevant.
>> It depends on the meaning of »the EOL would be irrelevant«.
[quoted text clipped - 4 lines]
>print "123\r\n" =~ /./ ? 1 : 0; #
>prints 1111
Insofar you are right. But the following example for Perl
5.8.3 shows that "\r\n" is not always matched by the ".*":
print "12345" =~ /^.*$/ ? 1 : 0;
print "123\r\n5" =~ /^.*$/ ? 1 : 0;
It prints »10« here. It seems as if there was a special rule
for a trailing "\r\n", that does not apply anymore when "\r\n"
appears in the middle of a text.
What I sometimes use to match it, is:
print "12345" =~ /^[^\001]*$/ ? 1 : 0;
print "123\r\n5" =~ /^[^\001]*$/ ? 1 : 0;
This could be used in Java as well, I assume.