これでちゃんと出てるんでしょうか。
http://www2.ocn.ne.jp/~cheerful/script/xyzzy/library/text.html より。
これでちゃんと出てるんでしょうか。
http://www2.ocn.ne.jp/~cheerful/script/xyzzy/library/text.html より。
(defun get-protocol-string (URI)(let (from end protocol server port)(setq from (string-match "^[^:/]+" URI))(setq end (match-end 0) )(when (and from end)(setq protocol (substring URI from end ))(setq URI (substring URI (1+ end))))(setq from (string-match "[^:/]+" URI))(setq end (match-end 0))(when (and from end)(setq server (substring URI from end ))(if (string-match "\\." server)(setq URI (substring URI end))(setq server nil)))(setq from (string-match "[0-9]+/" URI))(setq end (match-end 0))(when (and from end)(setq port (substring URI 1 (1- end)))(setq URI (substring URI (1- end))));(insert "protocol :[" protocol "]\n");(insert "server :[" server "]\n");(insert "port :[" port "]\n");(insert "target :[" URI "]\n")(values protocol server port URI)));for test(get-protocol-string "http://www2.ocn.ne.jp/~cheerful/script/index.html")(get-protocol-string "//http://www2.ocn.ne.jp/~cheerful/script/")(get-protocol-string "/~start/index.html")(get-protocol-string "/start/jkdjkaj/jkjdfjindex.html")(get-protocol-string "http://www2.ocn.ne.jp/~cheerful:80/~start/index.html")(get-protocol-string "//http://www2.ocn.ne.jp/~cheerful:80/~start/index.html");usage(multiple-value-setq (protocol server port file) (get-protocol-string "http://www2.ocn.ne.jp/~cheerful/~start"))