Re: Unicode::Collate string replacements and whitespace
[email protected] (Frank Müller) Mon, 27 Sep 2010 03:30:58 -0700 (PDT)
| Newsgroups | perl.unicode |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <2955c445-697b-4903-9990-2f9e2db016c6@a36g2000yqc.googlegroups.com> |
thank you very much for your answer. Both the workaround and your patch are working for me, but be sure I'll come back if I run into any troubles with it ;-) Frank On 22 Sep., 17:46, [email protected] (SADAHIRO Tomoyuki) wrote: > 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] }, \@wt if $to_be_pushed; > - } else { > + } elsif ($to_be_pushed) { > push @subWt, [ \@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