New answers tagged

1

The positive look-ahead (?= is \@= in Vim regex, non-capturing groups are \%(\) and capturing-groups are \(\). That would make your pattern: \s\%(\%([^'"`]*\(['"`]\)[^'"`]*\1\)*[^'"`]*$\)\@= There is a nice summary for comparing Perl compatible patterns with Vims in the help :h perl-patterns: Capability in Vimspeak in Perlspeak force ...


4

There is no difference in which symbols they encompass; both denote the digits from 0 to 9. They only differ in where they can resp. must be used. \d can not be used inside a collection, i.e., /[\d]/ will search for backslashes and lower case Ds, but not for digits. In contrast to this, [:digit:] must be used inside a collection, i.e., only /[[:digit:]]/ ...


1

The \a is indeed only matching alphabetical characters. The problem in your case is the .\{-} (similar to .*) which is matching a sequence of any characters in between the last alphabetical character and the comma. (I also don't understand why you're creating a group \(...\) which can be repeated once \{1}.) You can simplify your regexp to: :s/\a\+\ze,/(\0)/...


Top 50 recent answers are included