[wplug] OT: Emacs, regular expressions and syntax highlighting

George Larson george.g.larson at gmail.com
Tue Apr 2 14:10:51 EDT 2013


On Fri, Mar 29, 2013 at 10:30 AM, Douglas Green <diego96 at mac.com> wrote:

> Hi list-
>
> OT topic, but I thought there might be one or two emacs users in the linux
> crowd.
> I'm trying to customize emacs for my purposes- specifically I want to make
> my documents more "skimmable" by highlighing specific words. I'm stuck
> right now because I can't figure out how to write a regular expression that
> will highlight all instances of "foo" but not highlight "no foo" or "no
> evidence of foo".
>
> Any ideas, or perhaps alternate emacs packages to use (other than writing
> regular expressions for syntax highlighting)?
> Thanks!
> -Doug
>
> _______________________________________________
> wplug mailing list
> wplug at wplug.org
> http://www.wplug.org/mailman/listinfo/wplug
>

I'm a VIM guy and most definitely not the most skilled person here with
RegEx, but I figger' you could use a negative look behind:

Foo that is not following 'no ':
(?<!no )foo

Foo that is following neither 'no ' nor 'no evidence of':
(?:(?<!no )|(?<!no evidence of ))foo

Hopefully these will be useful in Emacs.

Good luck!


More information about the wplug mailing list