All pastes #821527 Raw Edit

perl-locale-testcase.pl

public text v1 · immutable
·published 2007-12-18 04:37 UTC
rendered paste body
#!/usr/bin/perl

# Using the en_CA.UTF-8 locale from glibc-2.6.1
# Perl version 5.8.8

use strict;
use locale;
use encoding 'utf8';

my $teststring = "zomg GmOz GMOZ zomg";
print "$teststring\n";

# This should transform the string to "zomg GmOz zomg", and works.
$teststring =~ s/\s*GMOZ//;
print "$teststring\n";

# This should transform the string to "zomg zomg", yet does nothing.
$teststring =~ s/\s*GMOZ//i;
print "$teststring\n";

# This should transform the string to " zomg", yet does nothing.
$teststring =~ s/.+GMOZ//i;
print "$teststring\n";

# This should transform the string to "zomg zomg", and works.
$teststring =~ s/\sGMOZ//i;
print "$teststring\n";

# This should transform the string to "zomg", and works.
$teststring =~ s/\s+ZOMG//i;
print "$teststring\n";