Reputation: 2511
I came across the following string comparison in a vim script.
echo my_test_var =~ '\\\@<!`.*\\\@<!`'
I am trying to figure out, what should be the value of my_test_var
so that the comparison returns 1
.
Upvotes: 1
Views: 56
Reputation: 626709
In Vim, the \@<!
is a negative lookbehind construct that fails any match if it is preceded with the lookbehind pattern. Thus, the whole expression will match a string like
`some \`text\` here`
as
\\\@<!`
- match a backtick that is not immediately preceded with a backslash.*
- matches 0+ characters, as many as possible\\\@<!`
- match a backtick that is not immediately preceded with a backslashUpvotes: 1