I'm writing libpcre binding of Emacs Lisp. Most of programmers is not familiar with Emacs Lisp regular expression because regular expression function or library of many languages has compatibility of Perl regular expression. I suppose such people writes regular expression easily with this library.
(let ((input "https://example.com/foo/bar/baz.txt") (regexp " ^ # backslash is not necessary for grouping (https?): # $1 schema // ([^/]+) # $2 host (/.*) # $3 path $ ")) (when (pcre-string-match regexp input '(extended)) ;; extends flag allows space/comment in regular expression (message "schema:%s, host:%s, path:%s" (match-string 1 input) (match-string 2 input) (match-string 3 input)))) ;; "schema:https, host:example.com, path:/foo/bar/baz.txt"
Issues or any suggestions
Please report me if you have any suggestions via github issue.