Last active
September 8, 2020 15:04
-
-
Save k0f1sh/9638ee04342cee30d55e9fa19a2b8080 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun re-seq (r s) | |
(let ((l) | |
(n 1) | |
(break nil)) | |
(save-match-data | |
(string-match r s) | |
(while (null break) | |
(if-let ((m (match-string n s))) | |
(progn | |
(push m l) | |
(incf n)) | |
(setf break t)))) | |
(nreverse l))) | |
;(re-seq (rx (group (* alpha)) "-" (group (* alpha))) "hoge-fuga");; => ("hoge" "fuga") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment