VIM 字串取代不用貪婪搜尋

I have a file that blah

I want to match rel="blahblah"

but when i do \rel=".*" it matches rel="blahblah" style="textdecoration:none;"

I have tried rel=".*\{-\}" but that gives an error nested \{

Ans:
You can use:

rel=".\{-}"
\{-} is used for non-greedy match in VIM

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 變更 )

Twitter picture

You are commenting using your Twitter account. Log Out / 變更 )

Facebook照片

You are commenting using your Facebook account. Log Out / 變更 )

Google+ photo

You are commenting using your Google+ account. Log Out / 變更 )

連結到 %s