Allow / in the regexes for search/groups
[debian/pino.git] / debian / patches / 003_improve-regex.diff
1 Description: Fix regex for search/tags
2 Author: Julien Valroff <julien@kirya.net>
3 Bug: http://code.google.com/p/pino-twitter/issues/detail?id=141
4 Forwarded: yes
5
6 --- a/src/template.vala
7 +++ b/src/template.vala
8 @@ -60,9 +60,9 @@
9                 
10                 //compile regex
11                 nicks = new Regex("(^|\\s)@([A-Za-z0-9_]+)");
12 -               tags = new Regex("((^|\\s)\\#[A-Za-z0-9_\\p{Latin}\\p{Greek}]+)");
13 -               groups = new Regex("(^|\\s)!([A-Za-z0-9_]+)"); //for identi.ca groups
14 -               urls = new Regex("((http|https|ftp)://([\\S]+))"); //need something better
15 +               tags = new Regex("(^|\\s|['+&!/\\(-])#([A-Za-z0-9_.-\\p{Latin}\\p{Greek}]+)");
16 +               groups = new Regex("(^|\\s|['+&!/\\(-])!([A-Za-z0-9_]+)"); //for identi.ca groups
17 +               urls = new Regex("((https?|ftp)://([A-Za-z0-9+&@#/%?=~_|!:,.;-]*)([A-Za-z0-9+&@#/%=~_|$]))"); // still needs to be improved for urls containing () such as wikipedia's
18                 
19                 // characters must be cleared to know direction of text
20                 clear_notice = new Regex("[: \n\t\r♻♺]+|@[^ ]+");
21 @@ -400,7 +400,7 @@
22                 }
23                 
24                 result = nicks.replace(result, -1, 0, "\\1@<a class='re_nick' href='userinfo://\\2'>\\2</a>");
25 -               result = tags.replace(result, -1, 0, "<a class='tags' href='%s\\1'>\\1</a>".printf(search_url));
26 +               result = tags.replace(result, -1, 0, "\\1#<a class='tags' href='%s\\2'>\\2</a>".printf(search_url));
27                 
28                 if(service == "identi.ca") //for identi.ca only
29                         result = groups.replace(result, -1, 0, "\\1!<a class='tags' href='http://identi.ca/group/\\2'>\\2</a>");