Terr!

I have a little script, which should from textfile input grab out every non-alpha characters and pipe then all alphas line by line to another function. I tried with [[:alpha:]] and \w/\W, but both work with diacritics (aka umlaut-chars) in one context but not in other. So i made an simple example script to show my point:

#!/usr/bin/perl use strict; use utf8; binmode STDIN, ":utf8"; binmode STDOUT, ":utf8"; my $str = "See on üks täppidega lause!"; # sample string, want to get +rid of spaces and exclamation mark, all other are alphas, and i reall +y need them # first printout ( how [[:alpha:]] works) foreach my $mrk ( split(//, $str) ) { if ($mrk =~ /^[[:alpha:]]$/ ) { print "$mrk"; } } print "\n\n"; # end of first printout # second printout ( how [[:alpha:]] doesn't works) $str =~ s/[[:^alpha:]]//ig; print "$str\n"; # end of second printout exit(0); __END__ First output: Seeonükstäppidegalause Second should be also same, but is: Seeonkstppidegalause

Why replace does not know that diacritics are also alphas? Or is there something wrong in my code? I can see workaraound (to write my own replace, for example), but i'd like to get it work in standard way.

Perl is v5.8.8, in Kubuntu 8.04.

TIA,

Kõike hääd, WK

In reply to Why [[:alpha:]] doesn't involve diacritic characters in replace expression? by wk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.