Bug#825475: perl: regular expression wide character and problem with catch group $1

Leszek Dubiel leszek.dubiel at dubielvitrum.pl
Fri May 27 06:16:02 UTC 2016


Package: perl
Version: 5.20.2-3+deb8u4
Severity: normal

Dear Maintainer,

*** Reporter, please consider answering these questions, where appropriate ***

The program 

	#!/usr/bin/perl

	use utf8; 
	use locale; 
	use strict; 
	use warnings; 

	binmode STDOUT, ":utf8";
	binmode STDIN, ":utf8";
	binmode STDERR, ":utf8";

	my $a = "ĄĄĄĄ"; 
	my $x = $a; 
	my $y = $a; 

	$x =~ s/([[:alpha:]])([[:alpha:]])/lc($1) . lc($2); /ge; 
	$y =~ s/([[:alpha:]])([[:alpha:]])/my $z = $1; lc($z) . lc($2); /ge; 

	print "$x\n$y\n"; 

prints: 

	1ąąą
	ąąąą

instead of: 

	ąąąą
	ąąąą

See the very first printed character. 
See the solution with $z assingment. 

Locale setting: 

LANG=pl_PL.UTF-8
LC_ADDRESS=pl_PL.UTF-8
LC_IDENTIFICATION=pl_PL.UTF-8
LC_MEASUREMENT=pl_PL.UTF-8
LC_MONETARY=pl_PL.UTF-8
LC_NAME=pl_PL.UTF-8
LC_NUMERIC=pl_PL.UTF-8
LC_PAPER=pl_PL.UTF-8
LC_TELEPHONE=pl_PL.UTF-8
LC_TIME=pl_PL.UTF-8


*** End of the template - remove these template lines ***


-- System Information:
Debian Release: 8.4
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 3.16.0-4-686-pae (SMP w/4 CPU cores)
Locale: LANG=pl_PL.UTF-8, LC_CTYPE=pl_PL.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages perl depends on:
ii  dpkg          1.17.26
ii  libbz2-1.0    1.0.6-7+b3
ii  libc6         2.19-18+deb8u4
ii  libdb5.3      5.3.28-9
ii  libgdbm3      1.8.3-13.1
ii  perl-base     5.20.2-3+deb8u4
ii  perl-modules  5.20.2-3+deb8u4
ii  zlib1g        1:1.2.8.dfsg-2+b1

Versions of packages perl recommends:
ii  netbase  5.3
pn  rename   <none>

Versions of packages perl suggests:
pn  libterm-readline-gnu-perl | libterm-readline-perl-perl  <none>
pn  make                                                    <none>
pn  perl-doc                                                <none>

-- no debconf information




More information about the Perl-maintainers mailing list