aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sx.el10
1 files changed, 9 insertions, 1 deletions
diff --git a/sx.el b/sx.el
index 7f6b901..19c5f12 100644
--- a/sx.el
+++ b/sx.el
@@ -294,7 +294,15 @@ DATA can also be the link itself."
(cdr (assoc 'link data)))))
(when (stringp link)
(replace-regexp-in-string
- "^https?://\\(?:\\(?1:[^/]+\\)\\.stackexchange\\|\\(?2:[^/]+\\)\\)\\.[^.]+/.*$"
+ (rx line-start "http" (optional "s") "://"
+ (or
+ (sequence
+ (group-n 1 (+ (not (any "/"))))
+ ".stackexchange")
+ (group-n 2 (+ (not (any "/")))))
+ "." (+ (not (any ".")))
+ "/" (* any)
+ line-end)
"\\1\\2" link))))
(defun sx--ensure-site (data)