comparison lisp/emacs-lisp/regexp-opt.el @ 19782:013cea3890cb

(regexp-opt): Doc fix.
author Richard M. Stallman <rms@gnu.org>
date Sun, 07 Sep 1997 01:24:23 +0000
parents 4a6dd3081185
children d2cb43703bfb
comparison
equal deleted inserted replaced
19781:03264c342376 19782:013cea3890cb
2 2
3 ;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. 3 ;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
4 4
5 ;; Author: Simon Marshall <simon@gnu.ai.mit.edu> 5 ;; Author: Simon Marshall <simon@gnu.ai.mit.edu>
6 ;; Keywords: strings, regexps 6 ;; Keywords: strings, regexps
7 ;; Version: 1.05.01
8 7
9 ;; This file is part of GNU Emacs. 8 ;; This file is part of GNU Emacs.
10 9
11 ;; GNU Emacs is free software; you can redistribute it and/or modify 10 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by 11 ;; it under the terms of the GNU General Public License as published by
82 ;;; Code: 81 ;;; Code:
83 82
84 ;;;###autoload 83 ;;;###autoload
85 (defun regexp-opt (strings &optional paren) 84 (defun regexp-opt (strings &optional paren)
86 "Return a regexp to match a string in STRINGS. 85 "Return a regexp to match a string in STRINGS.
87 Each string should be unique in STRINGS and should not contain any regexps. 86 Each string should be unique in STRINGS and should not contain any regexps,
88 If optional PAREN non-nil, ensure that the returned regexp is enclosed by at 87 quoted or not. If optional PAREN is non-nil, ensure that the returned regexp
89 least one regexp grouping construct. 88 is enclosed by at least one regexp grouping construct.
90 The returned regexp is typically more efficient than the equivalent regexp: 89 The returned regexp is typically more efficient than the equivalent regexp:
91 90
92 (let ((open-paren (if PAREN \"\\\\(\" \"\")) (close-paren (if PAREN \"\\\\)\" \"\"))) 91 (let ((open-paren (if PAREN \"\\\\(\" \"\")) (close-paren (if PAREN \"\\\\)\" \"\")))
93 (concat open-paren (mapconcat 'regexp-quote STRINGS \"\\\\|\") close-paren)) 92 (concat open-paren (mapconcat 'regexp-quote STRINGS \"\\\\|\") close-paren))
94 93