开发者

How can I search a text using regex excluding a character?

I want to search a text using regex using \S but excludi开发者_JAVA百科ng the "," at the end.

p.e.: text, tàta réta

My regex must find text (without the ",") tàta réta

I tried this but it didn't work:

/\<\S+[^,]

\w doesn't work also, because it doesn't find the non ascii characters èéòà etc.


Read up on

:he /zero-width

I think with default options you meant (note the \+ instead of just +)

/\<\S\+[^,]

This won't work because + is greedy by default, and the comma is not a whitespace :)

I suppose this would do what you want:

/\<\S\{-}\>,\@!

With verymagic, this could be a whole lot cleaner

/\v<\S+>,@!
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜