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))) (setq urlreg "\\(?:http://\\)?www\\(?:[./#\+-]\\w*\\)+")