On 25 Jan 2014, at 22:17, ZyX wrote: >> I'm fairly new to Vim myself, but I just tried this. >> >> I entered this into a new buffer -- >> >> - This is a te- st >> - foo bar >> - This is another - test I mean >> >> and ran this from the command line (using "x" as the replacement text) -- >> >> :%s/\v^(.+)\- /\1x/g >> >> and I got this: >> >> - This is a texst >> - foo bar >> - This is another xtest I mean >> >> Note that I used "\v" (very magic) to make Vim use regular expressions that >> the rest of the world understands. :-) > > Not as easy. According to the documentation only alphanumeric characters, > underscore and non-ASCII are guaranteed not to have special meaning in this > mode. I.e. you must escape the space just as you escaped hyphenminus. Both > though *currently* have no special meaning.
Good to know about \v. That would have solved it really fast ^^ Niels
signature.asc
Description: OpenPGP digital signature
