Function: verilog-regexp-opt
verilog-regexp-opt is a function alias for regexp-opt, defined in
regexp-opt.el.gz.
Signature
(verilog-regexp-opt STRINGS &optional PAREN)
Documentation
Return a regexp to match a string in the list STRINGS.
Each member of STRINGS is treated as a fixed string, not as a regexp. Optional PAREN specifies how the returned regexp is surrounded by grouping constructs.
If STRINGS is the empty list, the return value is a regexp that never matches anything.
The optional argument PAREN can be any of the following:
a string
the resulting regexp is preceded by PAREN and followed by
\), e.g. use "\\\\(?1:" to produce an explicitly numbered
group.
words
the resulting regexp is surrounded by \<\( and \)\>.
symbols
the resulting regexp is surrounded by \_<\( and \)\_>.
non-nil
the resulting regexp is surrounded by \( and \).
nil
the resulting regexp is surrounded by \(?: and \), if it is
necessary to ensure that a postfix operator appended to it will
apply to the whole expression.
The returned regexp is ordered in such a way that it will always match the longest string possible.
Up to reordering, the resulting regexp is equivalent to but usually more efficient than that of a simplified version:
(defun simplified-regexp-opt (strings &optional paren)
(let ((parens
(cond ((stringp paren) (cons paren "\\\\)"))
((eq paren 'words) '("\\\\\\=<\\\\(" . "\\\\)\\\\>"))
((eq paren 'symbols) '("\\\\_<\\\\(" . "\\\\)\\\\_>"))
((null paren) '("\\\\(?:" . "\\\\)"))
(t '("\\\\(" . "\\\\)")))))
(concat (car parens)
(mapconcat 'regexp-quote strings "\\\\|")
(cdr parens))))
Aliases
c-regexp-opt (obsolete since 29.1)
verilog-regexp-opt