diff options
| -rw-r--r-- | lisp/subr.el | 15 |
1 files changed, 15 insertions, 0 deletions
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." | |||
| 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. |