What regular expression in Vim will match all
characters up to no. in the below sting?
foo, bar, and baz, no. 13, qux
In other words the match must be foo, bar, and baz,
I'm new with regular expressions, did my research here on Stack
Overflow, and one suggestion is .+?(?= no.). But it seems to work
only with the regular (perl?) flavour of regular expressions, not in
Vim.
Please, help.
Maybe there's a simpler solution to what I'm trying to achieve. My ultimate goal is to put foo, bar, and baz in curly brackets, and I planned to to a global substitution command involving regular expressions.
this regex in vim should do
.*\zeno
e.g. you do this on your line:
s/.*\zeno//
that line would be changed into:
no. 13, qux
EDIT
just saw your "ultimate goal", you can just use the regex:
:s/.*\zeno/{&}
if you don't want to wrap the comma:
:s/.*\ze, no/{&}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With