On Sat, Dec 4, 2010 at 17:56,  <[email protected]> wrote:
> Joshua Gimer <[email protected]> wrote:
>
>> On Sat, Dec 4, 2010 at 5:26 PM, Gary Kline <[email protected]> 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).
> _______________________________________________
> [email protected] mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "[email protected]"
>

Also, the + operator means '1 or more' but needs escaped:  %s/[0-9]\+/foo/g
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[email protected]"

Reply via email to