Thursday, April 1, 2010

Re: Search & Replace

To this html code I wanted to select the text between the tags and replace the original text with \n character removed. There is a more complex example that I wanted to ask, here is the problem:

Original
______________________________
<p>Mike
<strong>Gilbert </strong>
Senior</p>
_____________________________

After search & replace:
______________________________
<p>Mike <strong>Gilbert</strong> Senior</p>
_____________________________

I hope you really got what I was asking.

TIA


On Thu, Apr 1, 2010 at 8:25 PM, Tim Chase <vim@tim.thechases.com> wrote:
Kunal Bajpai wrote:
I have been using Vim for about 3-4 months and am a student web
developer. I am still learning Vim and need help with a command.
I am editing some web pages using web pages many a times I have to
edit web pages. Here is what I want:

______________________________
<p>Mike
Gilbert
Senior</p>
_____________________________

I need a command that selects the whole html code including the
newline character.

While you can include "\n" in your search pattern for the newline,

 /<p>Mike\nGilbert\nSenior<\/p>

you don't specify *what* you want to do with it once  you've selected it.  Do you want to replace all or a portion with something?  Do you want to indent it?  Capitalize it?

With more information, it may be possible to get a solution to modify all your files in one pass.  You may also read up in the help regarding windo/argdo/bufdo/tabdo  for performing an action on a collection of files (since you mention multiple pages).

-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

To unsubscribe, reply using "remove me" as the subject.

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