From 4055a67eba8743c2a84b3de2871bb51d058b3b01 Mon Sep 17 00:00:00 2001 From: naru Date: Thu, 11 Mar 2004 08:58:08 +0000 Subject: [PATCH] =?utf8?q?m//=E7=AD=89=E3=81=AE=E3=83=96=E3=83=A9=E3=82=B1?= =?utf8?q?=E3=83=83=E3=83=88=E3=81=A7=E5=9B=B2=E3=81=BE=E3=82=8C=E3=81=A6?= =?utf8?q?=E3=81=84=E3=81=AA=E3=81=84=E6=AD=A3=E8=A6=8F=E8=A1=A8=E7=8F=BE?= =?utf8?q?=E3=82=92=E8=87=AA=E5=8B=95=E3=81=A7=E5=9B=B2=E3=82=80SafeRegExp?= =?utf8?q?=E9=96=A2=E6=95=B0=E3=82=92=E5=B0=8E=E5=85=A5=E3=80=81=E3=83=AD?= =?utf8?q?=E3=82=B0=E6=A4=9C=E7=B4=A2=E9=83=A8=E3=81=A8=E3=82=A2=E3=82=AF?= =?utf8?q?=E3=82=B7=E3=83=A7=E3=83=B3=E6=9D=A1=E4=BB=B6=E9=83=A8=E5=88=86?= =?utf8?q?=E3=81=A7=E5=88=A9=E7=94=A8=E3=81=99=E3=82=8B=E3=82=88=E3=81=86?= =?utf8?q?=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- bottleclient/BottleChainRule.pas | 4 ++-- bottleclient/BottleDef.pas | 19 +++++++++++++++++++ bottleclient/SearchLog.dfm | 2 +- bottleclient/SearchLog.pas | 23 +++-------------------- 4 files changed, 25 insertions(+), 23 deletions(-) diff --git a/bottleclient/BottleChainRule.pas b/bottleclient/BottleChainRule.pas index 5e46500..88151b3 100755 --- a/bottleclient/BottleChainRule.pas +++ b/bottleclient/BottleChainRule.pas @@ -1480,7 +1480,7 @@ begin Dat := (Event as TBottleChainBottleEvent).Data; try if Dat['Script'] <> '' then - Result := RegExp.Match(Pattern, Dat['Script']) + Result := RegExp.Match(Pattern, SafeRegExp(Dat['Script'])) else Result := false; except @@ -1905,7 +1905,7 @@ begin Dat := (Event as TBottleChainBottleEvent).Data; try if Dat['Script'] <> '' then - Result := not RegExp.Match(Pattern, Dat['Script']) + Result := not RegExp.Match(Pattern, SafeRegExp(Dat['Script'])) else Result := false; except diff --git a/bottleclient/BottleDef.pas b/bottleclient/BottleDef.pas index 74b5b60..18655e2 100755 --- a/bottleclient/BottleDef.pas +++ b/bottleclient/BottleDef.pas @@ -346,6 +346,10 @@ function SafeFileName(From: String; ChangePathDelimiters: boolean = true): Strin function ComponentToString(Component: TComponent): string; function StringToComponent(Value: string): TComponent; +// m//k ‚Ȃǂň͂܂ê‚Ä‚¢‚È‚¢³‹K•\Œ»‚𐳂µ‚­ˆÍ‚ñ‚Å +// BRegExpƒGƒ‰[‚Ì”­¶‚ð–h‚® +function SafeRegExp(Expression: String): String; + implementation function ParamsEncode(const ASrc: string): string; @@ -461,6 +465,21 @@ begin end; end; +function SafeRegExp(Expression: String): String; +begin + Result := Expression; + try + //Perl‚̐³‹K•\Œ»\•¶‚Ƀ}ƒbƒ`‚·‚鐳‹K•\Œ»‚Ń`ƒFƒbƒN + //kƒIƒvƒVƒ‡ƒ“‚ÍŠ¿Žš‘Ήž + //#255(0xFF)‚Í‚ ‚肦‚È‚¢‚Ì‚Å‚±‚±‚Å—˜—p + if not RegExp.Match('m/^m?(.).+\1\w*$/k', Result) then + Result := 'm'#255 + Result + #255'k'; + except + on EBRegExpError do + Result := ''; + end; +end; + { TBottlePrefs } constructor TBottlePrefs.Create; diff --git a/bottleclient/SearchLog.dfm b/bottleclient/SearchLog.dfm index f0c7a87..a9a5852 100644 --- a/bottleclient/SearchLog.dfm +++ b/bottleclient/SearchLog.dfm @@ -110,7 +110,7 @@ object frmSearchLog: TfrmSearchLog Top = 16 Width = 327 Height = 20 - Hint = #12473#12463#12522#12503#12488#12395#21547#12414#12428#12427#25991#23383#21015#12290#27491#35215#34920#29694#12398#22580#21512#12399'm//k'#12391#25375#12416 + Hint = #12473#12463#12522#12503#12488#12395#21547#12414#12428#12427#25991#23383#21015 Anchors = [akLeft, akTop, akRight] TabOrder = 0 end diff --git a/bottleclient/SearchLog.pas b/bottleclient/SearchLog.pas index 71cdb4e..fa9141f 100644 --- a/bottleclient/SearchLog.pas +++ b/bottleclient/SearchLog.pas @@ -204,31 +204,14 @@ begin end; procedure TfrmSearchLog.btnOkClick(Sender: TObject); -var tmpScriptPattern : String; begin - tmpScriptPattern := edtScriptPattern.Text; - - if cbxScriptRegExp.Checked then - begin - if tmpScriptPattern <> '' then - begin - try - //Perl‚̐³‹K•\Œ»\•¶‚Ƀ}ƒbƒ`‚·‚鐳‹K•\Œ»‚Ń`ƒFƒbƒN - //kƒIƒvƒVƒ‡ƒ“‚ÍŠ¿Žš‘Ήž - //#255(0xFF)‚Í‚ ‚肦‚È‚¢‚Ì‚Å‚±‚±‚Å—˜—p - if not RegExp.Match('m/^m?(.).+\1\w*$/k',tmpScriptPattern) then - tmpScriptPattern := 'm'#255 + tmpScriptPattern + #255'k'; - except - tmpScriptPattern := ''; - end; - end; - end; - // Œ‹‰ÊOK‚ŃEƒBƒ“ƒhƒE‚ð•Â‚¶‚é with Condition do begin - ScriptPattern := tmpScriptPattern; + ScriptPattern := edtScriptPattern.Text; ScriptRegExp := cbxScriptRegExp.Checked; + if ScriptRegExp and (ScriptPattern <> '') then + ScriptPattern := SafeRegExp(ScriptPattern); Channel := cbxChannel.Text; Ghost := cbxGhost.Text; MinVote := spnMinVote.Value; -- 2.11.0