I would like match Err in any words(e.g. LastError), but not ErrorMode.
(defvar txt-mode-font-lock-keywords
  `(
    ;; 文件名
    ("\\\\\\(\\w+\\.exe\\)" 1 font-lock-keyword-face)
    ;; IP和版本
    ("[^0-9]\\([0-9]\\{1,3\\}\\.[0-9]\\{1,3\\}\\.[0-9]\\{1,3\\}\\.[0-9]\\{1,3\\}\\)" 1 font-lock-keyword-face)
    ;; Error
    ("\\<\\([Dd][Bb][Ee][Rr][Rr][Oo][Rr]\\)\\>" 1 font-lock-warning-face)
    ("\\<\\([Dd][Bb][Ee][Rr][Rr]\\)\\>" 1 font-lock-warning-face)
    ("\\<\\([Ee][Rr][Rr][Oo][Rr]\\)\\>" 1 font-lock-warning-face)
    ("\\([Ee][Rr][Rr]\\)\\(?!orMode\\)" 1 font-lock-warning-face)
    ("\\(错误\\)" 1 font-lock-warning-face)
    ("\\(失败\\)" 1 font-lock-warning-face)
    ("\\(严重\\)" 1 font-lock-warning-face)
    ("\\<\\([Ff][Aa][Ii][Ll][Ee][Dd]\\)\\>" 1 font-lock-warning-face)
    ("\\<\\([Ff][Aa][Ii][Ll]\\)\\>" 1 font-lock-warning-face)
    ("\\<\\([Cc][Aa][Nn]\\s+[Nn][Oo][Tt]\\)\\>" 1 font-lock-warning-face)
    ("\\<\\([Cc][Aa][Nn]'[Tt]\\)\\>" 1 font-lock-warning-face)
    ("\\<\\([Ww][Rr][Oo][Nn][Gg]\\)\\>" 1 font-lock-warning-face)
    ;; Warning
    ("\\<\\([Ww][Aa][Rr][Nn][Ii][Nn][Gg]\\)\\>" 1 font-lock-warning-face)
    ("\\<\\([Ww][Aa][Rr][Nn]\\)\\>" 1 font-lock-warning-face)
    ("\\(警告\\)" 1 font-lock-warning-face)
    ;; Exception
    ("\\<\\([Ee][Xx][Cc][Ee][Pp][Tt][Ii][Oo][Nn]\\)\\>" 1 font-lock-warning-face)
    ("\\<\\([Ee][Xx][Cc][Ee][Pp][Tt]\\)\\>" 1 font-lock-warning-face)
    ("\\(异常\\)" 1 font-lock-warning-face)
    )
  "Basic font lock keywords for txt mode.  Highlights keywords.")

2012/2/3 Kevin Rodgers <kevin.d.rodgers@gmail.com>
On 2/2/12 2:45 PM, Tassilo Horn wrote:
Tim Landscheidt<tim@tim-landscheidt.de>  writes:

In Perl, "(?!pattern)" is a zero-width negative look-ahead
assertion.  Emacs does not support these AFAIK.

I see.  So when you do /foo(?!bar)/ in Perl, you'd need to do
"foo\\(?:[^b][^a][^r]\\)" in elisp.

IIUC, the Perl regex would successfully match "foo" if it were followed by
"far", but the Emacs regexp would not.

Maybe \(?:[^b][^a][^r]\) should be \(?:[^b]\|b[^a]\|ba[^r]\)

--
Kevin Rodgers
Denver, Colorado, USA