Commit bbf1ffd7 authored by Paul Eggert's avatar Paul Eggert
Browse files

Regexp Functions doc minor fixes

* doc/lispref/searching.texi (Regexp Functions):
Fix misspelling of “matching”.  Use @table for table.
Reformat code example to fit into info file width (Bug#17862).
parent 5b734087
...@@ -950,37 +950,41 @@ more efficient, but is almost never worth the effort.}. ...@@ -950,37 +950,41 @@ more efficient, but is almost never worth the effort.}.
The optional argument @var{paren} can be any of the following: The optional argument @var{paren} can be any of the following:
a string @table @asis
the resulting regexp is preceded by @var{paren} and followed by @item a string
@samp{\)}, e.g. use @samp{"\\(?1:"} to produce an explicitly The resulting regexp is preceded by @var{paren} and followed by
numbered group. @samp{\)}, e.g. use @samp{"\\(?1:"} to produce an explicitly
numbered group.
@code{words} @item @code{words}
the resulting regexp is surrounded by @samp{\<\(} and @samp{\)\>}. The resulting regexp is surrounded by @samp{\<\(} and @samp{\)\>}.
@code{symbols} @item @code{symbols}
the resulting regexp is surrounded by @samp{\_<\(} and @samp{\)\_>} The resulting regexp is surrounded by @samp{\_<\(} and @samp{\)\_>}
(this is often appropriate when maching programming-language (this is often appropriate when matching programming-language
keywords and the like). keywords and the like).
non-@code{nil} @item non-@code{nil}
the resulting regexp is surrounded by @samp{\(} and @samp{\)}. The resulting regexp is surrounded by @samp{\(} and @samp{\)}.
@code{nil} @item @code{nil}
the resulting regexp is surrounded by @samp{\(?:} and @samp{\)}, The resulting regexp is surrounded by @samp{\(?:} and @samp{\)},
if it is necessary to ensure that a postfix operator appended to if it is necessary to ensure that a postfix operator appended to
it will apply to the whole expression. it will apply to the whole expression.
@end table
The resulting regexp of @code{regexp-opt} is equivalent to but usually The resulting regexp of @code{regexp-opt} is equivalent to but usually
more efficient than that of a simplified version: more efficient than that of a simplified version:
@example @example
(defun simplified-regexp-opt (strings &optional paren) (defun simplified-regexp-opt (strings &optional paren)
(let ((parens (cond ((stringp paren) (cons paren "\\)")) (let ((parens
((eq paren 'words) '("\\<\\(" . "\\)\\>")) (cond
((eq paren 'symbols) '("\\_<\\(" . "\\)\\_>")) ((stringp paren) (cons paren "\\)"))
((null paren) '("\\(?:" . "\\)")) ((eq paren 'words) '("\\<\\(" . "\\)\\>"))
(t '("\\(" . "\\)"))))) ((eq paren 'symbols) '("\\_<\\(" . "\\)\\_>"))
((null paren) '("\\(?:" . "\\)"))
(t '("\\(" . "\\)")))))
(concat (car paren) (concat (car paren)
(mapconcat 'regexp-quote strings "\\|") (mapconcat 'regexp-quote strings "\\|")
(cdr paren)))) (cdr paren))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment