changeset 80097:7fa347fa0577

(rcirc-url-regexp): Replace definition by copying from gnus-button-url-regexp.
author Richard M. Stallman <rms@gnu.org>
date Sun, 10 Feb 2008 14:03:53 +0000
parents 85a8ae02bd0a
children c2981640cb2c
files lisp/net/rcirc.el
diffstat 1 files changed, 18 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/net/rcirc.el	Sun Feb 10 13:03:08 2008 +0000
+++ b/lisp/net/rcirc.el	Sun Feb 10 14:03:53 2008 +0000
@@ -1887,23 +1887,24 @@
     string))
 
 (defvar rcirc-url-regexp
-  (rx-to-string
-   `(and word-boundary
-	 (or (and
-	      (or (and (or "http" "https" "ftp" "file" "gopher" "news"
-			   "telnet" "wais" "mailto")
-		       "://")
-		  "www.")
-	      (1+ (char "-a-zA-Z0-9_."))
-	      (1+ (char "-a-zA-Z0-9_"))
-	      (optional ":" (1+ (char "0-9"))))
-	     (and (1+ (char "-a-zA-Z0-9_."))
-		  (or ".com" ".net" ".org")
-		  word-boundary))
-	 (optional
-	  (and "/"
-	       (1+ (char "-a-zA-Z0-9_=!?#$\@~`%&*+|\\/:;.,{}[]()"))
-	       (char "-a-zA-Z0-9_=#$\@~`%&*+|\\/:;{}[]()")))))
+  (concat
+   "\\b\\(\\(www\\.\\|\\(s?https?\\|ftp\\|file\\|gopher\\|"
+   "nntp\\|news\\|telnet\\|wais\\|mailto\\|info\\):\\)"
+   "\\(//[-a-z0-9_.]+:[0-9]*\\)?"
+   (if (string-match "[[:digit:]]" "1") ;; Support POSIX?
+       (let ((chars "-a-z0-9_=#$@~%&*+\\/[:word:]")
+	     (punct "!?:;.,"))
+	 (concat
+	  "\\(?:"
+	  ;; Match paired parentheses, e.g. in Wikipedia URLs:
+	  "[" chars punct "]+" "(" "[" chars punct "]+" "[" chars "]*)" "[" chars "]"
+	  "\\|"
+	  "[" chars punct     "]+" "[" chars "]"
+	  "\\)"))
+     (concat ;; XEmacs 21.4 doesn't support POSIX.
+      "\\([-a-z0-9_=!?#$@~%&*+\\/:;.,]\\|\\w\\)+"
+      "\\([-a-z0-9_=#$@~%&*+\\/]\\|\\w\\)"))
+   "\\)")
   "Regexp matching URLs.  Set to nil to disable URL features in rcirc.")
 
 (defun rcirc-browse-url (&optional arg)