[tomboy] Fix handling of ] } ) in links



commit bde1d9a547936b40d40fa627acf36f5b3b3dbd01
Author: Sandy Armstrong <sanfordarmstrong gmail com>
Date:   Fri Jun 10 16:55:43 2011 -0700

    Fix handling of ] } ) in links
    
    https://bugzilla.gnome.org/show_bug.cgi?id=531085

 Tomboy/Watchers.cs |   42 +++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 41 insertions(+), 1 deletions(-)
---
diff --git a/Tomboy/Watchers.cs b/Tomboy/Watchers.cs
index 105205e..879725e 100644
--- a/Tomboy/Watchers.cs
+++ b/Tomboy/Watchers.cs
@@ -374,7 +374,47 @@ 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)~/\S+)\S*\b/?)";
+			//@"((\b((news|http|https|ftp|file|irc)://|mailto:|(www|ftp)\.|\S* \S*\ )|(?<=^|\s)/\S+/|(?<=^|\s)~/\S+)\S*\b/?)";
+			    @"("+
+		    		@"(("+
+		    		    @"(?<=(?<starter>("+        // preceded by a starter
+		    			 @"(?<starterA>(\())"+	//	opening parenthesis closed by )
+		    			@"|(?<starterB>(\[))"+	// or	opening bracket	    closed by ]
+		    			@"|(?<starterC>(\{))"+	// or	opening thing	    closed by }
+		    		    @")))"+
+		    		    @"|\b"+			    //  or at beginning of a word \b
+//		    		@")"+
+//		    		@"("+
+		    		    @"("+
+		    			@"(news|http|https|ftp|file|irc)://"+    // http:// ...
+		    		        @"|mailto:"+				// or mailto...
+		    			@"|(www|ftp)\."+				// or www...
+		    		        @"|\S* \S*\ "+				// or email adress
+		    		    @")"+
+		    		@")"+
+		    		@"|("+
+		    		    @"(?<=(?<starter>("+        // preceded by a starter
+		    			 @"(?<starterA>(\())"+	//	opening parenthesis closed by )
+		    			@"|(?<starterB>(\[))"+	// or	opening bracket	    closed by ]
+		    			@"|(?<starterC>(\{))"+	// or	opening thing	    closed by }
+		    		    @")))"+
+				    @"|(?<=^|\s)"+
+		    		    @"("+
+			    		    @"(/\S+/)"+				// or starting with '/'
+			    		    @"|(~/\S+)"+				// or starting with '~/'
+		    		    @")"+
+		    		@"))"+
+		    		@"(?(starter)"+			    //
+		    		    @"(\S(?!("+			    // if starter detected : forbid ender
+									//ignore this comment (for syntax) ([{
+		    			@"(?(starterA)\)|"+				// closing parenthesis
+		    			@"(?(starterB)\]|"+				// closing bracket
+		    			@"(?(starterC)\})))"+				// closing thing
+		    		    @")))*\S?"+
+		    		    @"|\S*/?"+			    // else anything without space
+		    		@")"+
+		    	    @")";
+
 		
 
 		static Regex regex;



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