Regular Expressions/Emacs Regular Expressions
Appearance
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
[edit | edit source]Tools and languages that utilize this regular expression syntax include:
Links
[edit | edit source]- Regular Expressions at emacswiki.org
- Perl and Emacs regular expressions compared at lemoda.net