From: 土星五号 <laf163@gmail.com>
To: Kevin Rodgers <kevin.d.rodgers@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: does emacs regular expression support (?!expression)
Date: Fri, 3 Feb 2012 10:12:27 +0800 [thread overview]
Message-ID: <CADU1KvJdK50PAG9E8266g=5EhUNo5H_N1V-NgC0=uT-LSrgL8Q@mail.gmail.com> (raw)
In-Reply-To: <jgfa7c$76h$1@dough.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 2247 bytes --]
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 <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
>
>
>
[-- Attachment #2: Type: text/html, Size: 3855 bytes --]
next prev parent reply other threads:[~2012-02-03 2:12 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-02 14:02 does emacs regular expression support (?!expression) 土星五号
2012-02-02 18:56 ` Tassilo Horn
2012-02-02 21:14 ` Tim Landscheidt
2012-02-02 21:45 ` Tassilo Horn
2012-02-02 22:11 ` Tim Landscheidt
2012-02-02 22:17 ` Tim Landscheidt
2012-02-03 0:37 ` Kevin Rodgers
2012-02-03 2:12 ` 土星五号 [this message]
2012-02-03 8:30 ` Thien-Thi Nguyen
2012-02-03 11:17 ` Tim Landscheidt
2012-02-03 11:48 ` Thien-Thi Nguyen
2012-02-04 10:12 ` Tim Landscheidt
2012-02-04 12:16 ` 土星五号
2012-02-04 15:26 ` Thien-Thi Nguyen
2012-02-05 11:57 ` Tim Landscheidt
2012-02-02 22:09 ` Glenn Morris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CADU1KvJdK50PAG9E8266g=5EhUNo5H_N1V-NgC0=uT-LSrgL8Q@mail.gmail.com' \
--to=laf163@gmail.com \
--cc=help-gnu-emacs@gnu.org \
--cc=kevin.d.rodgers@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.