Mercurial > emacs
comparison lisp/subr.el @ 20491:d884af34ba47
(match-string-no-properties): New function.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 21 Dec 1997 02:08:37 +0000 |
parents | f213a5906ea6 |
children | 95e051979faf |
comparison
equal
deleted
inserted
replaced
20490:c383d1397e12 | 20491:d884af34ba47 |
---|---|
976 (if (match-beginning num) | 976 (if (match-beginning num) |
977 (if string | 977 (if string |
978 (substring string (match-beginning num) (match-end num)) | 978 (substring string (match-beginning num) (match-end num)) |
979 (buffer-substring (match-beginning num) (match-end num))))) | 979 (buffer-substring (match-beginning num) (match-end num))))) |
980 | 980 |
981 (defun match-string-no-properties (num &optional string) | |
982 "Return string of text matched by last search, without text properties. | |
983 NUM specifies which parenthesized expression in the last regexp. | |
984 Value is nil if NUMth pair didn't match, or there were less than NUM pairs. | |
985 Zero means the entire text matched by the whole regexp or whole string. | |
986 STRING should be given if the last search was by `string-match' on STRING." | |
987 (if (match-beginning num) | |
988 (if string | |
989 (let ((result | |
990 (substring string (match-beginning num) (match-end num)))) | |
991 (set-text-properties 0 (length result) nil result) | |
992 result) | |
993 (buffer-substring-no-properties (match-beginning num) | |
994 (match-end num))))) | |
995 | |
981 (defun split-string (string &optional separators) | 996 (defun split-string (string &optional separators) |
982 "Splits STRING into substrings where there are matches for SEPARATORS. | 997 "Splits STRING into substrings where there are matches for SEPARATORS. |
983 Each match for SEPARATORS is a splitting point. | 998 Each match for SEPARATORS is a splitting point. |
984 The substrings between the splitting points are made into a list | 999 The substrings between the splitting points are made into a list |
985 which is returned. | 1000 which is returned. |