[Xfce4-commits] <xfce4-clipman-plugin:master> [actions] Fix anchored regex

Mike Massonnet noreply at xfce.org
Sun Dec 13 12:18:01 CET 2009


Updating branch refs/heads/master
         to 44e930912ca4e2a7d3089484113805f2a35e38a5 (commit)
       from f07af5a7e157073425b8e8816ca0438dae571372 (commit)

commit 44e930912ca4e2a7d3089484113805f2a35e38a5
Author: Mike Massonnet <mmassonnet at xfce.org>
Date:   Sun Dec 13 12:12:29 2009 +0100

    [actions] Fix anchored regex
    
    The use of the compilation flag ANCHORED only constraint the match at
    the first matching point. Now the regex is changed manually with $ at
    the end.

 panel-plugin/actions.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/panel-plugin/actions.c b/panel-plugin/actions.c
index caec7f2..239635a 100644
--- a/panel-plugin/actions.c
+++ b/panel-plugin/actions.c
@@ -512,6 +512,7 @@ clipman_actions_add (ClipmanActions *actions,
   ClipmanActionsEntry *entry;
   GSList *l;
   GRegex *_regex;
+  gchar *regex_anchored;
 
   g_return_val_if_fail (G_LIKELY (action_name != NULL), FALSE);
   g_return_val_if_fail (G_LIKELY (command_name != NULL), FALSE);
@@ -523,7 +524,9 @@ clipman_actions_add (ClipmanActions *actions,
   if (l == NULL)
     {
       /* Validate the regex */
-      _regex = g_regex_new (regex, G_REGEX_CASELESS|G_REGEX_ANCHORED, 0, NULL);
+      regex_anchored = g_strdup_printf ("%s$", regex);
+      _regex = g_regex_new (regex_anchored, G_REGEX_CASELESS|G_REGEX_ANCHORED, 0, NULL);
+      g_free (regex_anchored);
       if (_regex == NULL)
         return FALSE;
 



More information about the Xfce4-commits mailing list