

Emacs' "old" regexp syntax - mtoledo

I've been using emacs recently, and I had a bunch of code editing I needed done. Figured I'd use emacs for the regex heavy lifting.<p>I failed miserably. My capturing groups didn't work. Then my digit character classes didn't work either. I was stunned.. what was I doing wrong?<p>Then I stumbled on Steve Yegge's emacs reg-exp post, where explains all of those limitations:<p><pre><code>    *  You have to escape the (, ), {, }, and | metacharacters. That is, they're not metacharacters by default — without the backslash, they match themselves.

    * There's no '\d' shortcut for the [0-9] character class.

    * There are no lookahead or lookbehind assertions.

    * There are no direct equivalents for Perl's {n}?, {n,}?, {n,m}?, /i, /m, /s, /x, \G, or (?# ...) constructs.

</code></pre>
So, one of his examples matches: \(public Relative \)\(\w\)\(\w+\)<p>while usually you'd match: (public Relative)(\w)(\w+)<p>I really must say that I was surprised that, being such a killer editor, we as a community never got round to implementing a modern regexp syntax for emacs.<p>Is it that hard? Do many people miss this? ..or you eventually get used to the old syntax and skipping everything?<p>http://steve-yegge.blogspot.com/2006/06/shiny-and-new-emacs-22.html
======
sri
see rx.el in (i think) the emacs-lisp directory

~~~
mtoledo
Will do. Thanks for the tip.

