[pLog-svn] r1878 - plog/branches/plog-1.0.1/tools

oscar at devel.plogworld.net oscar at devel.plogworld.net
Tue Apr 19 18:33:13 GMT 2005


Author: oscar
Date: 2005-04-19 18:33:13 +0000 (Tue, 19 Apr 2005)
New Revision: 1878

Modified:
   plog/branches/plog-1.0.1/tools/retest.php
Log:
a few improvements to the regular expression testing tool.

Modified: plog/branches/plog-1.0.1/tools/retest.php
===================================================================
--- plog/branches/plog-1.0.1/tools/retest.php	2005-04-19 18:28:06 UTC (rev 1877)
+++ plog/branches/plog-1.0.1/tools/retest.php	2005-04-19 18:33:13 UTC (rev 1878)
@@ -5,9 +5,12 @@
     //
     
     // initialization
-    $text = $_POST["text"];
-    $regexp = $_POST["regexp"];
-    $type = $_POST["type"];
+    if( isset( $_POST["text"] )) $text = $_POST["text"];
+    else $text = "";
+    if( isset( $_POST["regexp"])) $regexp = $_POST["regexp"];
+    else $regexp = "";
+    if( isset( $_POST["type"] )) $type = $_POST["type"];
+    else $type = "";
     $resultsAvailable = false;
     $successful = false;
     
@@ -16,7 +19,10 @@
         if( $type == "preg_match" ) {
             // use only preg_match as the method
             $result = preg_match( $regexp, $text, $matches );
-            $matchStrings = Array( $matches[1] );
+            if( isset( $matches[1] ))
+                $matchStrings = Array( $matches[1] );
+            else
+                $matchStrings = Array();
         }
         else {
             $result = preg_match_all( $regexp, $text, $matches );




More information about the pLog-svn mailing list