---- Support BBS ----
[ 前の記事 | 次の記事 | 一覧 ]

[00558] 1952 byte
投稿日時: 2002年1月17日(木) 2時10分28秒
ホスト名: pl047.nas323.soka.nttpc.ne.jp(210.165.163.143)

Re: BREGEXP DLL ラッパーDLL β公開

投稿者: 安久津
e-mail: (入力されていません)
   URL: (入力されていません)

brematch, bresplit の 引数 string, pattern の位置は
逆にした方がいいです。(^^;)シマッタ。
// --
  call loadbrewrapdll; if( ##return ){ beep; endmacro; }
  $$pattern = "/(03|045)-(\\d{3,4})-(\\d{4})/";
  $$string = "Yokohama 045-222-1111  Osaka 06-5555-6666  Tokyo 03-1111-9999";
  call brematch $$pattern, $$string; // 最初は引数付きで呼ぶ。
  ##length = ##return;
  while( ##length ){
    ##i = 0;
    while( ##i < ##length ){ insert $SUB[##i] + "\n"; ##i = ##i + 1; }
    call brematch; // 次は引数無しで呼ぶ。
    ##length = ##return;
  }
// --
  $$pattern = "/ *\\d{2,3}-\\d{3,4}-\\d{4} */";
  $$string = "Yokohama 045-222-1111  Osaka 06-5555-6666  Tokyo 03-1111-9999";
  call bresplit $$pattern, $$string, 0;
  ##length = ##return;
  ##i = 0;
  while( ##i < ##length ){ insert $SUB[##i] + "\n"; ##i = ##i + 1; }
  freedll;
endmacro;
// --
loadbrewrapdll:
  if( loaddllfile != hidemarudir + "\\bre_wrap.dll" ){
    loaddll hidemarudir + "\\bre_wrap.dll";
    if( ! result ) return 1;
  }
return 0;
brematch:
  if( $$1 != "" ){
    $__RXP = $$1; $__STR = $$2;
    #__POS = 0; #__LEN = strlen($__STR);
  }
  if( #__POS >= #__LEN ) return 0;
  $$p = dllfuncstr("BRE_MATCH", $__RXP, midstr($__STR, #__POS, #__LEN));
  if($$p == "") return 0;
  ##i = 0;
  $SUB[##i] = dllfuncstr("BRE_POSTOSTR", $$p);
  ##i = ##i + 1;
  ##s = strstr($$p, ":");
  ##tmp = val(midstr($$p,0,##s)) + val(midstr($$p, ##s+1, strlen($$p)-##s-1));
  #__POS = #__POS  + ##tmp;
  while( dllfunc("BRE_HASMORERESULTS") ){
    $$p = dllfuncstr("BRE_GETNEXT");
    $SUB[##i] = dllfuncstr("BRE_POSTOSTR", $$p);
    ##i = ##i + 1;
  }
return ##i;
bresplit:
  $$re = $$1; $$st = $$2; ##lm = ##3; // limit
  ##len = dllfunc("BRE_SPLIT", $$re, $$st, ##lm);
  ##i = 0; // ##i = 1 の方がいいのかな?
  while( dllfunc("BRE_HASMORERESULTS") ){
    $$p = dllfuncstr("BRE_GETNEXT");
    if( $$p == "" ) break;
    $SUB[##i] = dllfuncstr("BRE_POSTOSTR", $$p);
    ##i = ##i + 1;
  }
return ##len;


[ 前の記事 | 次の記事 | 一覧 ]


<550> BREGEXP DLL ラッパーDLL β公開 (杉浦 まさき) 01/15 02:55
<551> Re: BREGEXP DLL ラッパーDLL β公開 (安久津) 01/15 19:02
 └<552> Re: BREGEXP DLL ラッパーDLL β公開 (安久津) 01/15 19:04
  └<553> Re: BREGEXP DLL ラッパーDLL β公開 (杉浦 まさき) 01/15 22:37
   └<554> Re: BREGEXP DLL ラッパーDLL β公開 (安久津) 01/16 18:18
    └<555> Re: BREGEXP DLL ラッパーDLL β公開 (安久津) 01/16 18:19
     └<556> Re: BREGEXP DLL ラッパーDLL β公開 (杉浦 まさき) 01/16 23:01
      └<557> Re: BREGEXP DLL ラッパーDLL β公開 (安久津) 01/17 02:09
       └>558< Re: BREGEXP DLL ラッパーDLL β公開 (安久津) 01/17 02:10
        └<559> Re: BREGEXP DLL ラッパーDLL β公開 (杉浦 まさき) 01/18 00:30
         └<560> Re: BREGEXP DLL ラッパーDLL β公開 (安久津) 01/18 10:45
          └<561> Re: BREGEXP DLL ラッパーDLL β公開 (杉浦 まさき) 01/19 01:32
           └<562> Re: BREGEXP DLL ラッパーDLL β公開 (安久津) 01/19 17:43

---- Support BBS ----