In freebsd-questions Digest, Vol 339, Issue 11, Message: 30
On Sat, 4 Dec 2010 18:23:08 -0800 Gary Kline <kl...@thought.org> wrote:
 > On Sat, Dec 04, 2010 at 05:56:59PM -0800, per...@pluto.rain.com wrote:
 > > Joshua Gimer <jgi...@gmail.com> wrote:
 > > 
 > > > On Sat, Dec 4, 2010 at 5:26 PM, Gary Kline <kl...@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.

Except 0 itself? :)  You originally specified "ints from 0 to some N."

I think you want either [0-9][0-9]* or just [0-9]+ (one or more digits)

cheers, Ian
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Reply via email to