Lookahead and Lookbehind
Look everywhere
Start file
Example for reference: :%s/\(some\)\@<=thing/one/g searches for all strings starting with some, then matching thing changes thing into one end result: something becomes someone :%s/\(some\)\@<!thing/one/g searches for all strings not starting with some, then matching thing changes thing into one end result: something is not changed, but everything changes to everyone :%s/some\(thing\)\@=/every/g searches for all strings ending with thing, then matching some changes some into every end result: something becomes everything :%s/some\(thing\)\@!/every/g searches for all strings not ending with thing, then matching some changes some into every end result: something is not changed, but someone becomes everyone
End file
Example for reference: :%s/\(some\)\@<=thing/one/g searches for all strings starting with some, then matching thing changes thing into one end result: someone becomes someone :%s/\(some\)\@<!thing/one/g searches for all strings not starting with some, then matching thing changes thing into one end result: something is not changed, but everyone changes to everyone :%s/some\(thing\)\@=/every/g searches for all strings ending with thing, then matching some changes some into every end result: everything becomes everything :%s/some\(thing\)\@!/every/g searches for all strings not ending with thing, then matching some changes some into every end result: something is not changed, but everyone becomes everyone
View Diff
0a1 > 6c7 < end result: something becomes someone --- > end result: someone becomes someone 11c12 < end result: something is not changed, but everything changes to everyone --- > end result: something is not changed, but everyone changes to everyone 16c17 < end result: something becomes everything --- > end result: everything becomes everything 21c22 < end result: something is not changed, but someone becomes everyone --- > end result: something is not changed, but everyone becomes everyone
Solutions by @justinjaffray:
Unlock 8 remaining solutions by signing in and submitting your own entry