Morten Guldager <Morten.Guldager@gmail.com> writes:
> Shell# echo -ne 'A\t\n' | perl -pne 's/\s$//' | od -tx1
> 0000000 41 0a
>
> Fjernede det midterste tegn, TAB'en.
>
> Jeg havde forventet at det var LF'en der var røget.
>
> Nogen der kan forklare hvad jeg har misforstået?
$ matcher før newlinen tilsidst. Fra perlre:
By default, the "^" character is guaranteed to match only the
beginning of the string, the "$" character only the end (or before
the newline at the end), and Perl does certain optimizations with
the assumption that the string contains only one line.
Hvis du er interesseret i at matche \n skal du gøre det eksplicit.
--
Peter Makholm | There are 10 kinds of people. Those who count in
peter@makholm.net | binary and those who don't
http://hacking.dk |