7. Emacs正则表达式

Notes on regular expressions used in text editor Emacs:

  • For backslash escaping (magic vs literal), Emacs uses a mixture of BRE and ERE. Like in ERE, Emacs supports unescaped +, ?. Like in BRE, Emacs supports escaped \(, \), \|, \{, \}.
  • GNU extensions to regular expressions supported by Emacs include \w, \W, \b, \B, \<, \>, \` , \’ (start and end of buffer)
  • No “\s” like in PCRE; whitespace is matched by “\s-“.
  • No “\d” like in PCRE; use [0-9] or [[:digit:]]
  • No lookahead and no lookbehind like in PCRE
  • Emacs regexp can match characters by syntax using mode-specific syntax tables (“\sc”, “\s-“, “\s “) or by categories (“\cc”, “\cg”).

Use in Tools

Tools and languages that utilize this regular expression syntax include:



您的电子邮箱地址不会被公开。 必填项已用 * 标注