Date: Sat, 4 Dec 2010 18:23:08 -0800 From: Gary Kline <kline@thought.org> To: perryh@pluto.rain.com Cc: jgimer@gmail.com, freebsd-questions@freebsd.org Subject: Re: regex question.... Message-ID: <20101205022307.GB29153@thought.org> In-Reply-To: <4cfaf16b./uHAeLS0wfpxq8FB%perryh@pluto.rain.com> References: <20101205002602.GA27499@thought.org> <AANLkTinXsSHj4kLha9SgR4T0Rn7TvH1cKmZ-pYe%2BgC-k@mail.gmail.com> <4cfaf16b./uHAeLS0wfpxq8FB%perryh@pluto.rain.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Dec 04, 2010 at 05:56:59PM -0800, perryh@pluto.rain.com wrote: > Joshua Gimer <jgimer@gmail.com> wrote: > > > On Sat, Dec 4, 2010 at 5:26 PM, Gary Kline <kline@thought.org> wrote: > > > I have tried :1,$/s/[0-9]][0-9][0-9]/foo/g > > Why not just %s/[0-9]*/foo/g > > Too broad -- it will match the null string. (* means "zero or more > instances of" whatever preceded it.) > > Best RE I know for integers is > > [1-9][0-9]* > > (or replace the 1 with a 0 if the strings in question might have > leading zeros). YES, and Perry get an A+; the numbers do start with 1; no leading 0's. FWIW, the last time I Did this I was editina t text with almost 500 pages and didn't know that the "*" trick applied to the vi/vim world, so it saved me some typing. Thanks, gents. gary said before getting into the real work. HMMm, no, first need a cup of joe........ -- Gary Kline kline@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 7.97a release of Jottings: http://jottings.thought.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101205022307.GB29153>