A.J.Mechelynck wrote:
Nikolaos A. Patsopoulos wrote:
Hi,
I have a text that has many occurrences of a pattern . I want to
delete every consecutive occurrence, e.g.
Pattern Pattern other text Pattern Pattern Pattern Pattern other text
Pattern Pattern Pattern
should look like this:
Pattern other text Pattern other text Pattern
I've used:
:%s/\(Pattern\s\+\)\(Pattern\)/\1/g
but have to run this more than once with: %&g to result the wanted text.
Can I do this with one command only? If not can I write a while
function?:
while patternDoNotMatch
%s/\(Pattern\)\(Pattern\)/\1/g
endwhile
Thanks in advance,
Nikos
Assuming it's the _word_ Pattern, not any text that verifies a certain
_regular expression_ you can use (untested):
:%s/\(Pattern\_s*\)*/Pattern /g
oops...
:%s/\(Pattern\_s*\)\+/Pattern /g
Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
205. You're constantly yelling at your spouse, family, roommate, whatever,
for using the phone for stupid things...like talking.