Regular expression - vim matchstr() cannot match the number in :4:
大家讲道理
大家讲道理 2017-05-16 16:38:50
0
2
546

let a=['','']
echo matchstr(get(a,0),"[0-9] \+")
echo matchstr(get(a,1),"\d\+")
all display empty string


:s/\d\+/xxx/cg
can match 4
but the {pat} in matchstr() is unsuccessful!

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(2)
巴扎黑

Brother upstairs, the first suggestion is correct. echo matchstr(get(a,0),"[0-9]+")It is indeed empty, there is no problem

我想大声告诉你

I haven’t written it before, but I feel it is a problem with "". It is recommended to try:
1. Two \ For example: "[0-9]\+"
2. Remove For example: "[0-9]+"

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template