Monday, June 20, 2011

Re: remove all except pattern

Thank you, yes now it works with hello.

It doesn't work p.e. with emails.
This is my command to search emails:
\([A-Z0-9+_.-]\+@\([A-Z0-9-]\+\.\)\+[A-Z]\{2,6}\)

p.e.

myemail@mydomain.com hello myotheremail@mydomain.com
hello mylatestemail@mydomain.co.uk

Putting that in your command gives an empty output (it removes the
emails).

Regards,
Rameo


On Jun 20, 6:19 pm, Tim Chase <v...@tim.thechases.com> wrote:

> Ah...it looks like it was missing the "g" flag at the end:
>
> :%s/\w\+\W*/\=submatch(0)=~'hello'?submatch(0):''/g
>
> Something must not have copied over when I pasted it into the
> original email.
>

No problem

> -tim

--
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

No comments: