Open j5shi opened 8 years ago
Sometimes the fname will be parsed as (I've no idea why it happens in that way):
fname
C:\Program Files (x86)\vim\[18*No Name]
So the result of regex matchstr(fname, '\d\+') will be 86, which is obviously incorrect.
matchstr(fname, '\d\+')
86
You can use str2nr(matchstr(matchstr(fname, '\[\d\+\*No Name\]$'), '\d\+')) to solve it.
str2nr(matchstr(matchstr(fname, '\[\d\+\*No Name\]$'), '\d\+'))
Sometimes the
fname
will be parsed as (I've no idea why it happens in that way):C:\Program Files (x86)\vim\[18*No Name]
So the result of regex
matchstr(fname, '\d\+')
will be86
, which is obviously incorrect.