chickadee » s » s-match

s-match regexp sprocedure

When the given expression matches the string, this function returns a list of the whole matching string and a string for each matched subexpression. If it did not match the returned value is an empty list '().

(s-match "^def" "abcdefg") ;; => '()
(s-match "^abc" "abcdefg") ;; => '("abc")
(s-match "^.*/([a-z]+).([a-z]+)" "/some/weird/file.html") ;; => '("/some/weird/file.html" "file" "html")