regular expression – With regex, how to match misused blankspace inside tab indent
Say the line is:
^<space1><space2><tab1><tab2><space3><space4><tab3><tab4><space5><space6><tab5><tab6><space7><space8>blablabla
So how to match all these <space>?
(FYI, I use call matchadd("yqi_faulty_indent", '<THE_REGEX>') to highlight it)
- With
^\t*\zs\ \+, it matches only<space1><space2> - With
^\s*\zs\ \+, it matches only<space7><space8>due to the greedy mode I think - With
^\s\{-}\zs\ \+, it matches only<space1><space2>due to the non-greedy mode I think - With
\v((^\s*)@<= +), it matches what I want, BUT, with lookaround regex, there’s unacceptable high CPU when there are long lines likeseq 1 30000 | tr '\n' ' ' | fold -w 3000 | vim -
Read more here: Source link
