From: Richard M. Stallman Date: Sun, 21 Dec 1997 02:08:37 +0000 (+0000) Subject: (match-string-no-properties): New function. X-Git-Tag: emacs-20.3~2583 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=bb760c71f4ca5c0c60b9543e94a1bced38f0216e;p=emacs.git (match-string-no-properties): New function. --- diff --git a/lisp/subr.el b/lisp/subr.el index 5afb4215940..6dd33424cd2 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -978,6 +978,21 @@ STRING should be given if the last search was by `string-match' on STRING." (substring string (match-beginning num) (match-end num)) (buffer-substring (match-beginning num) (match-end num))))) +(defun match-string-no-properties (num &optional string) + "Return string of text matched by last search, without text properties. +NUM specifies which parenthesized expression in the last regexp. + Value is nil if NUMth pair didn't match, or there were less than NUM pairs. +Zero means the entire text matched by the whole regexp or whole string. +STRING should be given if the last search was by `string-match' on STRING." + (if (match-beginning num) + (if string + (let ((result + (substring string (match-beginning num) (match-end num)))) + (set-text-properties 0 (length result) nil result) + result) + (buffer-substring-no-properties (match-beginning num) + (match-end num))))) + (defun split-string (string &optional separators) "Splits STRING into substrings where there are matches for SEPARATORS. Each match for SEPARATORS is a splitting point.