let test = 'a href="http://www.google.com">www.google.com</a;'
Run Code Online (Sandbox Code Playgroud)
在vimscript中,如何http://www.google.com
使用正则表达式来解决这个问题,并将其存储在另一个变量中?
我似乎无法找到任何关于此的文档.
Luc*_*tte 29
let url = matchstr(test, '\ca href=\([''"]\)\zs.\{-}\ze\1')
if empty(url)
throw "no url recognized into ``".test."''"
endif
Run Code Online (Sandbox Code Playgroud)
有关更多信息,请参阅:
:h matchstr()
:h /\c
:h /\zs
:h /\{-
Run Code Online (Sandbox Code Playgroud)