Update useful-regex

This commit is contained in:
Marcus Kammer 2023-11-12 09:29:07 +01:00
parent 8a7ba04dd0
commit baed854ec3
Signed by: marcuskammer
GPG key ID: C374817BE285268F

View file

@ -9,23 +9,24 @@
"Locally mirror a website using `wget -mkEpnp <url>`") "Locally mirror a website using `wget -mkEpnp <url>`")
(defvar mk/useful-regex (defvar mk/useful-regex
'(("match any word or space that precede the :" . "[\w\s]+:") '(("match any word or space that precedes the :" . "[\\w\\s]+:")
("search for anything in square brackets" . "\[.*\]") ("search for anything in square brackets" . "\\[.*\\]")
("[A-Za-z]+" "upper and lowercase english alphabet") ("upper and lowercase English alphabet" . "[A-Za-z]+")
("[0-9]" "numbers from 0 to 9") ("numbers from 0 to 9" . "[0-9]")
("[A-Za-z\-\.]" "upper and lowercase english alphabet, - and .") ("upper and lowercase English alphabet, - and ." . "[A-Za-z\\-\\.]+")
("(a-z)" "a, - and z") ("a, - and z" . "(a-z)")
("(\s+|,)" "spaces or a comma") ("spaces or a comma" . "(\\s+|,)")
("#\w+" "find hashtags") ("find hashtags" . "#\\w+")
("([@|#]\w+)" "matches both mentions (@) and hashtags") ("matches both mentions (@) and hashtags" . "([@|#]\\w+)")
("(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)" "email regex") ("email regex" . "^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$")
("-?\d+(\.\d*)?" "matching decimal numbers") ("matching decimal numbers" . "-?\\d+(\\.\\d*)?")
("(?:http|https|ftp|mailto|file|data|irc):\/\/[A-Za-z0-9\-]{0,63}(\.[A-Za-z0-9\-]{0,63})+(:\d{1,4})?\/*(\/*[A-Za-z0-9\-._]+\/*)*(\?.*)?(#.*)?" "matching urls") ("matching urls" . "(?:http|https|ftp|mailto|file|data|irc):\\/\\/[A-Za-z0-9\\-]{0,63}(\\.[A-Za-z0-9\\-]{0,63})+(:\\d{1,4})?\\/*(\\/*[A-Za-z0-9\\-._]+\\/*)*(\\?.*)?(#.*)?")
("^\d{4}/(0[1-9]|1[0-2])/(0[1-9]|[12][0-9]|3[01])$" "matching dates yyyy/mm/dd") ("matching dates yyyy/mm/dd" . "^\\d{4}/(0[1-9]|1[0-2])/(0[1-9]|[12][0-9]|3[01])$")
("^(0[1-9]|1[0-2])/(0[1-9]|[12][0-9]|3[01])/\d{4}$" "matching dates mm/dd/yyyy") ("matching dates mm/dd/yyyy" . "^(0[1-9]|1[0-2])/(0[1-9]|[12][0-9]|3[01])/\\d{4}$")
("^(0[1-9]|[12][0-9]|3[01])/(0[1-9]|1[0-2])/\d{4}$" "matching dates dd/mm/yyyy") ("matching dates dd/mm/yyyy" . "^(0[1-9]|[12][0-9]|3[01])/(0[1-9]|1[0-2])/\\d{4}$")
("<.+>" "matching html") ("matching HTML" . "<.+>")
("<\/?(?:p|a|b|img)(?: \/)?>" "matchig specific tags"))) ("matching specific tags" . "</?(?:p|a|b|img)(?: /)?>")
("ISO 8601 Date Format (YYYY-MM-DD)" . "\\([0-9]{4}\\)-\\([0-1][0-9]\\)-\\([0-3][0-9]\\)")))
;; (defun mk-show-modeline () ;; (defun mk-show-modeline ()
;; (interactive) ;; (interactive)