Skip to main content
2 of 2
Added usage example.

Here is how you can do it based on strings, as requested.

(defun re-seq (regexp string) "Get a list of all regexp matches in a string" (save-match-data (let ((pos 0) matches) (while (string-match regexp string pos) (push (match-string 0 string) matches) (setq pos (match-end 0))) matches))) ; Sample URL (setq urlreg "\\(?:http://\\)?www\\(?:[./#\+-]\\w*\\)+") ; Sample invocation (re-seq urlreg (buffer-string))