match 只对最后一个有效?

5 views
Skip to first unread message

闲耘(tm)

unread,
Nov 4, 2009, 9:41:37 AM11/4/09
to vim...@googlegroups.com, vim-t...@googlegroups.com
hi URI_string gui=underline
match URI_string /\(http\|https\|ftp\|ftps\):\/\/\w\+\(\.\w\+\)\+\(\w\|\~\|\!\|@\|\#\|\$\|%\|&\|\^\|\*\|(\|)\|\-\|_\|+\|=\||\|\\\|\[\|\]\|{\|}\|;\|:\|,\|\.\|\/\|?\)*/
hi Email_string gui=underline
match Email_string /[a-zA-Z]\w*\(\.\w\+\)*@\w\+\(\.\w\+\)\+/

我定义了两个模式,一个让url带下划线,另一个让email带下划线,但是请问为什么只有最后一个生效的?

--
闲耘™ (@hotoo, xianyun.org)
Sent from Hangzhou, 33, China

Ricky

unread,
Nov 4, 2009, 10:02:56 AM11/4/09
to vim...@googlegroups.com
syn match URI_string /\(http\|https\|ftp\|ftps\):\/\/\w\+\(\.\w\+\)\+\(\w\|\~\|\!\|@\|\#\|\$\|%\|&\|\^\|\*\|(\|)\|\-\|_\|+\|=\||\|\\\|\[\|\]\|{\|}\|;\|:\|,\|\.\|\/\|?\)*/
syn match Email_string /[a-zA-Z]\w*\(\.\w\+\)*@\w\+\(\.\w\+\)\+/
 
我测试两个加上syn后都能同时显示下划线,没加的时候就只有最新生效的才能显示出来
email地址的正则该加上-
vim...@googlegroups.com 就只能从cn开始显示下划线,如果需要的话
---------------

闲耘(tm)

unread,
Nov 4, 2009, 10:58:45 AM11/4/09
to vim...@googlegroups.com
谢谢,这是新的Email验证,但是范围不够宽泛,会有一下domain不能通过验证

syn match Email_string /[a-zA-Z]\+\(\-\?\w\+\)*\(\.\w\+\(\-\?\w\+\)*\)*@\w\+\(\.\w\+\)\+/


--
闲耘™ (@hotoo, xianyun.org)
Sent from Hangzhou, 33, China


2009/11/4 Ricky <rich...@live.com>

闲耘(tm)

unread,
Nov 4, 2009, 8:46:15 PM11/4/09
to vim...@googlegroups.com
仍有一个问题,优先级不够,几乎除了文本文件有效,
对于例如html, js....之类有自己syntax的类型文件,则无效。

--
闲耘™ (@hotoo, xianyun.org)
Sent from Hangzhou, 33, China


Reply all
Reply to author
Forward
0 new messages