-
-
Save spacebat/5274045 to your computer and use it in GitHub Desktop.
I think the [^[] was making the start-of-line/string optional
This file contains 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
(let ((regex | |
(rx | |
(or bol bos) | |
(? (not (any "["))) | |
(group | |
(>= 2 (and (any "A-Z")(one-or-more (any "a-z"))))))) | |
case-fold-search) | |
(list | |
(replace-regexp-in-string regex "{\\1}" "[OneWordOrMore]") | |
(replace-regexp-in-string regex "{\\1}" "Onewordormore") | |
(replace-regexp-in-string regex "{\\1}" "[OneWordormore") | |
(replace-regexp-in-string regex "{\\1}" "OneWordOrMore") | |
:regex regex)) | |
;; gives ("[OneWordOrMore]" "Onewordormore" "[OneWordormore" "{OneWordOrMore}" :regex "\\(?:^\\|\\`\\)[^[]?\\(\\(?:[A-Z][a-z]+\\)\\{2,\\}\\)") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment