作者: 藤岡和夫
日時: 2004/7/13(20:48)
On Tue, 13 Jul 2004 20:44:00 +0900
藤岡和夫 <kazuf@...> さんwrote:

>  JIS第一水準漢字を全部通してみますと、それなりに意味があるようにマッチ
> が変化しますね。例えば、

 こんなスクリプトです。

use encoding "Shift_JIS";
while(<DATA>){
chomp;
next if /^$/;
$str = (split(/ +/,$_))[7];
print "alpha:", $str,"\n" if $str =~ /\p{IsAlpha}+/;
print "alnum:", $str,"\n" if $str =~ /\p{IsAlnum}+/;
print "ascii:", $str,"\n" if $str =~ /\p{IsASCII}+/;
#print "blank:", $str,"\n" if $str =~ /[[:blank:]]+/;
print "cntrl:", $str,"\n" if $str =~ /\p{IsCntrl}+/;
print "digit:", $str,"\n" if $str =~ /\p{IsDigit}+/;
print "graph:", $str,"\n" if $str =~ /\p{IsGraph}+/;
print "lower:", $str,"\n" if $str =~ /\p{IsLower}+/;
print "print:", $str,"\n" if $str =~ /\p{IsPrint}+/;
print "punct:", $str,"\n" if $str =~ /\p{IsPunct}+/;
print "space:", $str,"\n" if $str =~ /\p{IsSpace}+/;
print "upper:", $str,"\n" if $str =~ /\p{IsUpper}+/;
print "word:", $str,"\n" if $str =~ /\p{IsWord}+/;
print "xdigit:", $str,"\n" if $str =~ /\p{IsXDigit}+/;
print "InBasicLatin:", $str,"\n" if $str =~ /\p{InBasicLatin}+/;
}

__END__
01 01 2121 8140 A1A1 E38080 3000    
01 02 2122 8141 A1A2 E38081 3001   、
01 03 2123 8142 A1A3 E38082 3002   。
01 04 2124 8143 A1A4 EFBC8C FF0C   ,
01 05 2125 8144 A1A5 EFBC8E FF0E   .
01 06 2126 8145 A1A6 E383BB 30FB   ・
01 07 2127 8146 A1A7 EFBC9A FF1A   :
01 08 2128 8147 A1A8 EFBC9B FF1B   ;
01 09 2129 8148 A1A9 EFBC9F FF1F   ?

藤岡 和夫
FGALTS@...
kazuf@...
TS Networkのために http://homepage1.nifty.com/kazuf/