diff options
author | Sean Allred <code@seanallred.com> | 2014-12-26 17:22:03 -0500 |
---|---|---|
committer | Sean Allred <code@seanallred.com> | 2014-12-26 17:22:03 -0500 |
commit | d732176007abdcc3395f7188dc918981d9ff2801 (patch) | |
tree | edb3b42ee26c3502adf9ea1eb609d8f5d917593b | |
parent | 60e483c5f6bfa5ea897f3bc6f85f402b09f63d9e (diff) |
`rx'-ify regular expression
-rw-r--r-- | sx.el | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -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) |