Add patch to improve the regex used to detect the urls within statuses/notices
authorJulien Valroff <julien@kirya.net>
Sun, 30 May 2010 14:16:19 +0000 (16:16 +0200)
committerJulien Valroff <julien@kirya.net>
Sun, 30 May 2010 14:16:19 +0000 (16:16 +0200)
debian/patches/006_improve-url-regex.diff [new file with mode: 0644]
debian/patches/series

diff --git a/debian/patches/006_improve-url-regex.diff b/debian/patches/006_improve-url-regex.diff
new file mode 100644 (file)
index 0000000..3e39853
--- /dev/null
@@ -0,0 +1,16 @@
+Description: Improve the regex used for URLs
+Author: Julien Valroff <julien@kirya.net>
+Forwarded: yes
+Bug: http://code.google.com/p/pino-twitter/issues/detail?id=277
+
+--- a/src/template.vala
++++ b/src/template.vala
+@@ -62,7 +62,7 @@
+               nicks = new Regex("(^|\\s)@([A-Za-z0-9_]+)");
+               tags = new Regex("#([A-Za-z0-9_\\p{Latin}\\p{Greek}]+)");
+               groups = new Regex("(^|\\s)!([A-Za-z0-9_]+)"); //for identi.ca groups
+-              urls = new Regex("((http|https|ftp)://([\\S]+))"); //need something better
++              urls = new Regex("((https?|ftp)://([A-Za-z0-9+&@#/%?=~_|!:,.;]*)([A-Za-z0-9+&@#/%=~_|$]))"); // still needs to be improved for urls containing () such as wikipedia
+               
+               // characters must be cleared to know direction of text
+               clear_notice = new Regex("[: \n\t\r♻♺]+|@[^ ]+");
index a22aba3..8965983 100644 (file)
@@ -3,3 +3,4 @@
 003_fix-search-regex.diff
 004_allow-current-user-info.diff
 005_startup-notify.diff
+006_improve-url-regex.diff