xah talk show 2022-07-22 emacs lisp, parse url, regex, trigram, hexagram
- trigram, hexagram, korean flag.
- http://xahlee.org/music/the_grandmaster_kungfu.html
- http://xahlee.info/xli_search.html?q=emacs+lisp+list
- http://xahlee.info/comp/unicode_index.html?q=heart
- http://xahlee.info/comp/unicode_index.html?q=mono
- http://xahlee.info/comp/unicode_dingbats.html
- http://xahlee.info/xli_search.html?q=percent
(defun xparseURL (xurl)
"parse xurl, return a list of parts
version 2022-07-22"
(interactive)
(let (xprotocol xhost xport xresourcePath xfrag)
(string-match "^\\([a-zA-Z0-9]+\\)://\\([.a-zA-Z0-9]+\\):\\([0-9]+\\)/\\([/%a-zA-Z0-9]+\\)\\?\\([&%=a-zA-Z0-9]+\\)#\\([.a-zA-Z0-9]+\\)" xurl)
(setq xprotocol (match-string 1 xurl))
(setq xhost (match-string 2 xurl))
(setq xport (match-string 3 xurl))
(setq xresourcePath (match-string 4 xurl))
(setq xfrag (match-string 5 xurl))
(list xprotocol xhost xport xresourcePath xfrag)))
(xparseURL "http://www.example.com:80/a/b/c?x=1&y=2#frag")
(require 'url-parse)
(url-generic-parse-url "http://www.example.com:80/a/b/c?x=1&y=2#frag")