changeset 597:6997201c7b71

quotedb: Clean up regexp statements.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 03 Feb 2021 13:36:43 +0200
parents b524a6e4be63
children 40db54427950
files quotedb.tcl
diffstat 1 files changed, 14 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/quotedb.tcl	Wed Feb 03 11:50:02 2021 +0200
+++ b/quotedb.tcl	Wed Feb 03 13:36:43 2021 +0200
@@ -136,7 +136,7 @@
     return 0
   }
 
-  if {![regexp {^\s*([0-9]+)$} $utext umatch unum]} {
+  if {![regexp {^\s*([0-9]+)$} $utext -> unum]} {
     qdb_msg $ucmd $utable $upublic $unick $uchan "help_delete"
     return 0
   }
@@ -185,7 +185,7 @@
     return 0
   }
 
-  if {![regexp {^\s*([0-9]+)\s+(.+)$} $utext umatch unum uquote]} {
+  if {![regexp {^\s*([0-9]+)\s+(.+)$} $utext -> unum uquote]} {
     qdb_msg $ucmd $utable $upublic $unick $uchan "help_update"
     return 0
   }
@@ -254,12 +254,12 @@
   }
 
   set uvote 1
-  if {$utext == "" || [regexp {^\s*(-?1)\s*$} $utext umatch uvote]} {
+  if {$utext == "" || [regexp {^\s*(-?1)\s*$} $utext -> uvote]} {
     set usql "SELECT max(id) AS qid FROM ${utable}"
     set uid 0
     qdb_handle eval $usql { set uid $qid }
-  } elseif {[regexp {^\s*([0-9]+)$} $utext umatch uid]} {
-  } elseif {![regexp {^\s*([0-9]+)\s+(-1|1)$} $utext umatch uid uvote]} {
+  } elseif {[regexp {^\s*([0-9]+)$} $utext -> uid]} {
+  } elseif {![regexp {^\s*([0-9]+)\s+(-1|1)$} $utext -> uid uvote]} {
     qdb_msg $ucmd $utable $upublic $unick $uchan "help_vote"
     return 0
   }
@@ -450,31 +450,31 @@
   if {$utext == "" || $utext == {}} {
     # No arguments, assume random query
     qdb_get $ucmd $utable $upublic $unick $uhost $uhand $uchan $utext -1
-  } elseif {[regexp {^(stat|stats|tilasto|tilastot)$} $utext umatch]} {
+  } elseif {[regexp {^(stat|stats|tilasto|tilastot)$} $utext]} {
     # Statistics
     qdb_stats $ucmd $utable $upublic $unick $uhost $uhand $uchan $utext
-  } elseif {[regexp {^(last|latest|uusin|viimeisin)$} $utext umatch]} {
+  } elseif {[regexp {^(last|latest|uusin|viimeisin)$} $utext]} {
     # Latest added
     qdb_get $ucmd $utable $upublic $unick $uhost $uhand $uchan $utext -2
-  } elseif {[regexp {^([0-9]+)$} $utext umatch unum]} {
+  } elseif {[regexp {^([0-9]+)$} $utext -> unum]} {
     # Numeric argument, assume id query
     qdb_get $ucmd $utable $upublic $unick $uhost $uhand $uchan $utext $unum
-  } elseif {[regexp {^top\s*([0-9]+)?$} $utext umatch uargs]} {
+  } elseif {[regexp {^top\s*([0-9]+)?$} $utext -> uargs]} {
     # Toplist of quotes
     qdb_toplist $ucmd $utable $upublic $unick $uhost $uhand $uchan $utext $uargs
-  } elseif {[regexp {^add\s*(.*)$} $utext umatch uargs]} {
+  } elseif {[regexp {^add\s*(.*)$} $utext -> uargs]} {
     # Add quote
     qdb_add $ucmd $utable $upublic $unick $uhost $uhand $uchan $uargs
-  } elseif {[regexp {^del\s*([0-9]*)$} $utext umatch uargs]} {
+  } elseif {[regexp {^del\s*([0-9]*)$} $utext -> uargs]} {
     # Delete quote
     qdb_delete $ucmd $utable $upublic $unick $uhost $uhand $uchan $uargs
-  } elseif {[regexp {^update\s*(.*)$} $utext umatch uargs]} {
+  } elseif {[regexp {^update\s*(.*)$} $utext -> uargs]} {
     # Modify/update quote
     qdb_update $ucmd $utable $upublic $unick $uhost $uhand $uchan $uargs
-  } elseif {[regexp {^find\s*(.*)$} $utext umatch uargs]} {
+  } elseif {[regexp {^find\s*(.*)$} $utext -> uargs]} {
     # Find quote(s)
     qdb_find $ucmd $utable $upublic $unick $uhost $uhand $uchan $uargs
-  } elseif {[regexp {^vote\s*(.*)$} $utext umatch uargs]} {
+  } elseif {[regexp {^vote\s*(.*)$} $utext -> uargs]} {
     # Vote
     qdb_vote $ucmd $utable $upublic $unick $uhost $uhand $uchan $uargs
   } else {