diff options
| author | Richard M. Stallman | 1997-12-21 02:08:37 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1997-12-21 02:08:37 +0000 |
| commit | bb760c71f4ca5c0c60b9543e94a1bced38f0216e (patch) | |
| tree | 425022381d6392331c518ed0c19a58758f9e1558 | |
| parent | 255359cbccfc0d8381e3da9c01572c9fc222a5df (diff) | |
| download | emacs-bb760c71f4ca5c0c60b9543e94a1bced38f0216e.tar.gz emacs-bb760c71f4ca5c0c60b9543e94a1bced38f0216e.zip | |
(match-string-no-properties): New function.
| -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. |