[tomboy/gnome-2-26] Fix extraneous URL matchings, like this/that/other matching "/that/other", following up on bug #4369



commit cfa3f6732e7b0b16d9c1e7297021228c306ae80c
Author: Sandy Armstrong <sanfordarmstrong gmail com>
Date:   Sat Apr 25 08:55:34 2009 -0700

    Fix extraneous URL matchings, like this/that/other matching "/that/other", following up on bug #436994.
    
    Restore the original regular expression with checks for leading whitespace, but make sure to use zero-width positive lookbehind assertion to keep leading whitespace out of the match.
---
 Tomboy/Watchers.cs |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/Tomboy/Watchers.cs b/Tomboy/Watchers.cs
index 5ef9408..212cf13 100644
--- a/Tomboy/Watchers.cs
+++ b/Tomboy/Watchers.cs
@@ -374,7 +374,8 @@ namespace Tomboy
 		Gtk.TextMark click_mark;
 
 		const string URL_REGEX =
-		        @"((\b((news|http|https|ftp|file|irc)://|mailto:|(www|ftp)\.|\S* \S*\ )|/\S+/|~/\S+)\S*\b/?)";
+			@"((\b((news|http|https|ftp|file|irc)://|mailto:|(www|ftp)\.|\S* \S*\ )|(?<=^|\s)/\S+/|(?<=^|\s)~/\S+)\S*\b/?)";
+		
 
 		static Regex regex;
 		static bool text_event_connected;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]