开发者

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

开发者 https://www.devze.com 2023-02-22 13:21 出处:网络
I want to search a text using regex using \\S but excludi开发者_JAVA百科ng the \",\" at the end.

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

精彩评论

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