Greetings, Just trying to learn On Sat, Nov 3, 2012 at 3:24 PM, Tim Chase <v...@tim.thechases.com> wrote: > On 11/03/12 14:11, Chris Lott wrote: >> I have a large text file in which I need to remove all punctuation, >> all special characters ("smart quotes") and the like, and a bunch of >> selected words. >> >> Can this be done within Vim? > > Yes. > > Oh, you want to know *how*? :-P > > The smart-quotes are the hardest ones to do, but if you can enter > them in vim (or select+yank them, and then paste them into an Ex > command using control+R followed by a double-quote), they should be > usable: > > :%s/\([[:punct:]]\+\|”\|“\|selected\|words\)//g > > Alternatively, you might want to specify what *is* allowed and > invert it: > > :%s/\W\+//g " that's "everything that isn't a Word character" > or > :%s/[^[:alnum:][:space]]\+//g "all but alnum & spaces" > > which you can read about at > > :help :alnum: > :help /\W > :help /\| >
Asking because I don't know and I don't use smart quotes. What makes them so difficult to remove in a s/search/replace/g ? Aren't they just quotation marks? -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php