OSDN Git Service

m/パターン/k を入れなくても、正規表現パターンを入れるだけで検索できるよう変更
[winbottle/winbottle.git] / bottleclient / SearchLog.pas
index 73c6e96..0afb70e 100644 (file)
@@ -6,7 +6,7 @@ interface
 
 uses
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
-  Dialogs, StdCtrls, ExtCtrls, Spin;
+  Dialogs, StdCtrls, ExtCtrls, Spin, BRegExp;
 
 type
   // \8c\9f\8dõ\8fð\8c\8f\82ð\95\\82·\83N\83\89\83X\81B
@@ -204,11 +204,32 @@ begin
 end;
 
 procedure TfrmSearchLog.btnOkClick(Sender: TObject);
+var tmpScriptPattern,tmpStringReplace : String;
 begin
+  tmpScriptPattern := edtScriptPattern.Text;
+
+  if cbxScriptRegExp.Checked then
+  begin
+    if tmpScriptPattern <> '' then
+    begin
+      try
+        //Perl\82Ì\90³\8bK\95\\8c»\8d\\95\82É\83}\83b\83`\82·\82é\90³\8bK\95\\8c»\82Å\83`\83F\83b\83N
+        if not brx.Match('m/^m?(.).+\1\w*$/k',tmpScriptPattern) then
+        begin
+          tmpStringReplace := tmpScriptPattern;
+          tmpStringReplace := StringReplace(tmpStringReplace, '/', '\/', [rfReplaceAll]);
+          tmpScriptPattern := 'm/' + tmpStringReplace + '/k'; //k\83I\83v\83V\83\87\83\93\82Í\8a¿\8e\9a\91Î\89\9e
+        end;
+      except
+        tmpScriptPattern := '';
+      end;
+    end;
+  end;
+
   // \8c\8b\89ÊOK\82Å\83E\83B\83\93\83h\83E\82ð\95Â\82\82é
   with Condition do
   begin
-    ScriptPattern := edtScriptPattern.Text;
+    ScriptPattern := tmpScriptPattern;
     ScriptRegExp  := cbxScriptRegExp.Checked;
     Channel  := cbxChannel.Text;
     Ghost    := cbxGhost.Text;