expand Howard's RX macro
This commit is contained in:
parent
ef668dfc80
commit
46d18b6f8a
@ -963,8 +963,26 @@ Return nil if DIR is not in a hugo project at all."
|
||||
:config
|
||||
(defmacro prx (&rest expressions)
|
||||
"Convert the rx-compatible regular EXPRESSIONS to PCRE.
|
||||
Most shell applications accept Perl Compatible Regular Expressions."
|
||||
`(rxt-elisp-to-pcre (rx ,@expressions))))
|
||||
Most shell applications accept Perl Compatible Regular Expressions.
|
||||
|
||||
Taken from https://howardism.org/Technical/Emacs/eshell-why.html"
|
||||
`(rx-let ((integer (1+ digit))
|
||||
(float (seq integer "." integer))
|
||||
(b256 (seq (optional (or "1" "2"))
|
||||
(regexp "[0-9]\\{1,2\\}")))
|
||||
(ipaddr (seq b256 "." b256 "." b256 "." b256))
|
||||
(time (seq
|
||||
digit (optional digit)
|
||||
":" (= 2 digit) (optional ":" (= 2 digit))))
|
||||
(email (seq (1+ (regexp "[^,< ]")) "@"
|
||||
(1+ (seq (1+ (any alnum "-"))) ".") (1+ alnum)))
|
||||
(date (seq (= 2 digit) (or "/" "-")
|
||||
(= 2 digit) (or "/" "-") (= 4 digit)))
|
||||
(ymd (seq (= 4 digit) (or "/" "-")
|
||||
(= 2 digit) (or "/" "-") (= 2 digit)))
|
||||
(uuid (seq (= 8 hex) "-" (= 3 (seq (= 4 hex) "-")) (= 12 hex)))
|
||||
(guid (seq uuid)))
|
||||
(rxt-elisp-to-pcre (rx ,@expressions)))))
|
||||
|
||||
(provide 'mitch-packages)
|
||||
;;; mitch-packages.el ends here
|
||||
|
Loading…
Reference in New Issue
Block a user