Page 1 of 1

Trying to eliminate superfluous <CR>s

Posted: Thu Jul 12, 2007 6:41 pm
by ReverendDexter
Okay, I'm hoping that I just missed this with the search, but it's driving me nuts and my only alternative is to do this by hand.

I'm trying to get rid of some extra carriage returns in some text. Basically, I have some html <ul><li>Items</li>....</ul>, and right now there's a return (and space) between every item, specifically between the previous </li> and the next <li>.

I've tried

Code: Select all

:%s/>^M </></g
:%s/>^M </></m
:%s/>^M </></mg
and variations that escape the '<' and '>', and every which way I do it, I get an E488: Trailing Characters

Someone wanna beat me with the clue stick?

Posted: Fri Jul 13, 2007 12:45 pm
by ReverendDexter
So I ended up doing this by hand, I did a search for ">$", and then hitting nJx (next match, join lines, del char) about 300 times.

I really don't want to have to do it that way in the future.... no one has any ideas?

Posted: Fri Jul 13, 2007 2:29 pm
by Benjamin
I'd probably just write a quick PHP script to get rid of them if I absolutely had to.

Posted: Wed Jul 18, 2007 1:10 pm
by ReverendDexter
Yeah, that's what I'll probably end up doing if I have to do it again, but I know this is possible with the regex in Vim, and it bugs me that I can't figure it out there.

Posted: Wed Jul 18, 2007 1:12 pm
by John Cartwright
In Dreamweaver you can do a find all and replace :wink: