diff options
author | alecpl <alec@alec.pl> | 2010-10-04 13:53:15 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2010-10-04 13:53:15 +0000 |
commit | 9cc93aea7cda73d102c0a0045c66a5360da24b79 (patch) | |
tree | e96f1d627a54c2f313d413e38e9d6b3da11437c0 /program | |
parent | 135f84afa2140fc38348b15898a0912e31fb49c5 (diff) |
- Use simplified domain expression for proper handling of domain names in UTF8
Diffstat (limited to 'program')
-rw-r--r-- | program/include/rcube_string_replacer.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/program/include/rcube_string_replacer.php b/program/include/rcube_string_replacer.php index 1eed1bf3c..0471dd0dc 100644 --- a/program/include/rcube_string_replacer.php +++ b/program/include/rcube_string_replacer.php @@ -35,13 +35,13 @@ class rcube_string_replacer function __construct() { - $url_chars = 'a-z0-9_\-\+\*\$\/&%=@#:;'; - $url_chars_within = '\?\.~,!'; + // Simplified domain expression for UTF8 characters handling + $utf_domain = '[^&@"\'\\/\s\r\t\n]+\\.[a-z]{2,5}'; - $this->link_pattern = "/([\w]+:\/\/|\Wwww\.)([a-z0-9\-\.]+[a-z]{2,4}([$url_chars$url_chars_within]*[$url_chars])?)/i"; + $this->link_pattern = "/([\w]+:\/\/|\Wwww\.)($utf_domain(\S+)?)/i"; $this->mailto_pattern = "/(" ."[-\w!\#\$%&\'*+~\/^`|{}=]+(?:\.[-\w!\#\$%&\'*+~\/^`|{}=]+)*" // local-part - ."@([a-z0-9]([-a-z0-9]*[a-z0-9])?\\.)+[a-z]{2,5}" // domain-part + ."@$utf_domain" // domain-part ."(\?\S+)?" // e.g. ?subject=test... .")/i"; } |