MLUG: Re: [MLUG] Vi Regex problem
Re: [MLUG] Vi Regex problem
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
On Thu, Apr 04, 2002 at 04:03:09PM -0600, Robin Hastings wrote:
> I created a substitution regex that found the first cap letter after a
> comma and replaced it with quote marks. What I *wanted* was to find the
> first cap letter after a comma and insert quote marks in front of it.
> Here is the substitution I used: :s/,[A-Z]/,"/g. Is there a way to make
> vi insert rather than substitute in this situation? Thanks for any
> hints, tips or advice you can give me. Google failed me on this one...

Try somethinglike s/,([A-Z])/,"$1/g

The parantheses (sp?) are a grouping operator and tell vi
to assign whatever matches the pattern inside them to the next
group variable ($1, $2, $3, ...) The $1 of course then references
the first grouping from the matching part of your re.

-- 
Scott Hussey
EMAIL:PROTECTED
GnuPG public key: http://www.lcl.lib.mo.us/~scott/pubkey.gpg.txt
  "Give a man a blanket and he is warm for the night. Set him on fire
   and he'll never bother you again."
--
To unsubscribe, go to http://mlug.missouri.edu/members/edit.php

Archives are available at http://mlug.missouri.edu/list-archives/