vim/gedit delete words between character
You can use the following in vim to do what you want.
:%s/<[^>]*>\([^<]*\).*/\1/g
Here I use the s
command,
This is the complete syntax, you can check by typing :help :s
:[range]s[ubstitute]/{pattern}/{string}/[flags] [count]
% for range means the whole file, {pattern} is an regular rexpression
{string} means the string that has to be replaced. That can contain backreferences, i.e a part of the matched pattern enclosed within braces.
[flags] are some extra options. g
for global, i.e all the patterns in a line needs to be replaced. Other useful flag is c
which asks for confirmation before changing.
[count] must be the number of times, I guess.
So this can be read as, search for a lessthan< followed by any number or not a greaterthan> characters then a > then select any number of not a lessthan< characters into first group \1 then any number or any characters And replace this with the first group \1 globally.
Check this link to learn more about vim specific regular expression details http://www.softpanorama.org/Editors/Vimorama/vim_regular_expressions.shtml
Install surround.vim, which provides a normal-mode mapping dst
that should do the job.
In order to apply this to multiple lines, select them in the visual mode and invoke
:'<,'>normal dst
This will apply the normal-mode command dst
to the selected area. If you want to apply it to the entire file (not only the visual selection), use the following command
:%normal dst