Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defun regex-matches (re s &optional start)
- "Given a regular expression and a string, return a sequence of
- matches, including groups, if any."
- (cl-labels
- ((regex-matches
- (acc index)
- (let ((this-match (match-string index s)))
- (cond
- (this-match (regex-matches (cons this-match acc) (1+ index)))
- (t (reverse acc))))))
- (when (string-match re s start)
- (regex-matches '() 0))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement