It works well with .*$ in order to substitute and get first backward
reference.
^..\(.\{-}\)\s\+\d\+\.\d\+.\{,20} needed to add .*$
Thank you.
Le jeudi 10 octobre 2019 17:19:25 UTC+2, Andy Wokula a écrit :
>
> Am 10.10.2019 um 10:44 schrieb Ni Va:
> > Don't understand why it returns 2 first chars on this example :
> >
> > + 20191009_191004_Vim.8.1.2125/
> 4.0 KiB [D] 2019-10-
> > echo
> substitute(getline(line('.')),'^..\zs\(.\+\)\(\s\+\d\+\.\d\+\)\@=.*$','\1',
> "") returns + 20191009_191004_Vim.8.1.2125/
>
> The match starts after `\zs', what comes before is not substituted.
>
> I wonder why the greedy \(.\+\) does not include any spaces.
> Looks like \(\s\+\d\+\.\d\+\)\@= is checked before any backtracking takes
> place.
> "no backtracking" => actually this depends on re=0 or re=2.
>
> :echo substitute(getline('.'), '^..\(.\{-}\)\s\+\d\+\.\d\+.\{,20}$', '\1',
> '')
>
> --
> Andy
>
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_use/e9d96fcc-6fd9-4072-9601-15ed01eb0c99%40googlegroups.com.