Function: s-match
s-match is a byte-compiled function defined in s.el.
Signature
(s-match REGEXP S &optional START)
Documentation
When the given expression matches the string, this function returns a list of the whole matching string and a string for each matched subexpressions. Subexpressions that didn't match are represented by nil elements in the list, except that non-matching subexpressions at the end of REGEXP might not appear at all in the list. That is, the returned list can be shorter than the number of subexpressions in REGEXP plus one. If REGEXP did not match the returned value is an empty list (nil).
When START is non-nil the search will start at that index.
Source Code
;; Defined in ~/.emacs.d/elpa/s-20220902.1511/s.el
(defun s-match (regexp s &optional start)
"When the given expression matches the string, this function returns a list
of the whole matching string and a string for each matched subexpressions.
Subexpressions that didn't match are represented by nil elements
in the list, except that non-matching subexpressions at the end
of REGEXP might not appear at all in the list. That is, the
returned list can be shorter than the number of subexpressions in
REGEXP plus one. If REGEXP did not match the returned value is
an empty list (nil).
When START is non-nil the search will start at that index."
(declare (side-effect-free t))
(save-match-data
(if (string-match regexp s start)
(let ((match-data-list (match-data))
result)
(while match-data-list
(let* ((beg (car match-data-list))
(end (cadr match-data-list))
(subs (if (and beg end) (substring s beg end) nil)))
(setq result (cons subs result))
(setq match-data-list
(cddr match-data-list))))
(nreverse result)))))