On 2/2/07, Ralph Shumaker <[EMAIL PROTECTED]> wrote:
Ralph Shumaker wrote:

> Ralph Shumaker wrote:
>
>> Now I want to do a search an replace (with verification) of something
>> involving mixed case.  I tried to figure out the formula, but I'm
>> hitting a catch-22 with my limited knowledge.
>>
>> Let's say I want to replace a whole bunch of "the" and "The" with
>> "this" and "This" respectively.  And I need to make sure that "the"
>> and "The" are not preceded nor followed by alpha.  How would I do
>> this?  Oh, and how can I make it so that the highlighted match is
>> always vertically centered (so I can see context)?
>>
>> ("the" and "The" are not the only sets I want to replace with others,
>> so I really would like to know a formula.  Or am I just better off
>> doing the replace twice? once for lowercase and again for upper?)
>>
>>
>>
> I think I just figured it out:
> ":%s/\([^A-Za-z][Tt]h\)e\([^A-Za-z]\)/\1is\2/c
>
> The trick to getting it was to realize that the set \(\) is not
> actually part of the search but only like an embedded copy function
> with \1 and \2 being the embedded paste function.
>
>
(Sorry, guys.  I slipped and hit send before trimming that last one.)

The above substitute command gives the following prompt:
replace with \1is\2 (y/n/a/q/l/^E/^Y)?

I know the first 4 items, but what are the others?


Movement commands.  l (lower case L) move to the next line down
^E  scroll the display down one line
^Y  scroll the display up one line

By the way, you made me read my copy of _Vi Editor Pocket Reference_
by Arnold Robbins, O'Reilly 1999.

   carl
--
   carl lowenstein         marine physical lab     u.c. san diego
                                                [EMAIL PROTECTED]


--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to