TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [TCLUG:9061] regex
Luke Francl said:
> Here's another question. I'm a bit confused by the /g aspect of regex
> replacing in vi. Supposedly, it stands for "global" right? But it only
> does the replace until the end of the line.
The /g makes it global for the line.  For instance, if I run
s/it/vi
on the line
> replacing in vi. Supposedly, it stands for "global" right? But it only
I get
> replacing in vi. Supposedly, vi stands for "global" right? But it only
                      replaced ^^                   not replaced ^^
while 
s/it/vi/g
produces
> replacing in vi. Supposedly, vi stands for "global" right? But vi only
                               ^^         both replaced          ^^