文字列からの情報抽出
Posted feedbacks - 秀丸マクロ
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | $output = "";
disabledraw;
gofiletop;
while( true ) {
searchdown2 "[A-Za-z]+(-hidden)?(-(small|big))?\\.[A-Za-z]+", regular;
if ( !result ) {
break;
}
#x = x;
#y = y;
searchdown "[-.]", regular;
$name = gettext( #x, #y, x, y );
$size = "normal";
$hidden = "False";
while( code == '-' ) {
movetolineno column + 1 + strlen( "-" ), lineno;
#x = x;
#y = y;
searchdown "[-.]", regular;
$option = gettext( #x, #y, x, y );
if ( $option == "big" ) {
$size = "big";
}
if ( $option == "small" ) {
$size = "small";
}
if ( $option == "hidden" ) {
$hidden = "True";
}
}
movetolineno column + 1 + strlen( "." ), lineno;
#x = x;
#y = y;
searchdown "[^A-Za-z]", regular;
if ( !result ) {
gofileend;
}
$ext = gettext( #x, #y, x, y );
$output = $output + "name:'" + $name + "', ext:'" + $ext+"', size: " + $size+" hidden: " + $hidden + "\n";
}
enabledraw;
newfile;
insert $output;
|



にしお
#3407()
Rating0/0=0.00
サンプル入力
サンプル出力
探すべき文字列は下の条件を満たします
出力は以下の条件を満たす必要があります
このお題は、正規表現のグループに名前をつけて連想配列として取得できるPythonからの挑戦状です。
[ reply ]