Next: , Previous: Forcing Emacs to iconify itself, Up: Common requests

5.36 How do I use regexps (regular expressions) in Emacs?

See Regexp Backslash.

The or operator is ‘\|’, not ‘|’, and the grouping operators are ‘\(’ and ‘\)’. Also, the string syntax for a backslash is ‘\\’. To specify a regular expression like ‘xxx\(foo\|bar\)’ in a Lisp string, use ‘xxx\\(foo\\|bar\\)’.

Note the doubled backslashes!