Negative Lookbehind in vim
very similar to the last post, but this time for _not_ matching text that is preceded with some other text, and this time using the vim regex engine which is syntactically a little different
This will match the 'Date' in 'EndDate' and 'YesterdaysDate' but will not match 'StartDate'
and what the hell, while I'm lookup up vim syntax, here's negative lookahead:
will match the 'Start' in 'Starting but not in 'StartDate'
Positive lookahead:
will match the 'Start' in 'StartDate' but not in 'Starting
Positive lookbehind
will match the 'Date' in 'StartDate' but not in 'EndDate' and 'YesterdaysDate'
/\(Start\)\@<!Date
This will match the 'Date' in 'EndDate' and 'YesterdaysDate' but will not match 'StartDate'
and what the hell, while I'm lookup up vim syntax, here's negative lookahead:
/Start\(Date\)\@!
will match the 'Start' in 'Starting but not in 'StartDate'
Positive lookahead:
/Start\(Date\)\@=
will match the 'Start' in 'StartDate' but not in 'Starting
Positive lookbehind
/\(Start\)\@<=Date
will match the 'Date' in 'StartDate' but not in 'EndDate' and 'YesterdaysDate'