perl-unicode

Re: Unicode::Collate string replacements and whitespace

2010-09-22 10:46:24
Thank you for your bug report,

A workaround would be
    $myCollator->gsubst($str, "camelhorse", sub { "$_[0]" });
(removal of the space from the substring)

and a patch should be

        if (@subWt && !$var && !$wt[0]) {
            push @{ $subWt[-1] }, \(_at_)wt if $to_be_pushed;
-       } else {
+       } elsif ($to_be_pushed) {
            push @subWt, [ \(_at_)wt ];
        }
     }

Regards,
SADAHIRO Tomoyuki

dear all,
most probably I'm missing something quite obvious and very simple,
but I am no expert with Perl and Unicode yet.
 I'm making some string replacements with Unicode::Collate
which generally works fine but for whitespace. I have the following
simple code (adopted from the module documentation):
 
my $myCollator = Unicode::Collate->new( normalization => undef, level => 1 );
my $str = "Camel donkey zebra camex{301}l CAMEL horse cAmEL...";
$myCollator->gsubst($str, "camel horse", sub { "$_[0]" });
print $str;

this doesn't find the search string "camel horse" - if I search
for "camel" the desired replacemts work ("camel").

How can I get this working with whitespace in the search string?
Thanks for any hints,
Frank

<Prev in Thread] Current Thread [Next in Thread>