Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Dec 2010 02:13:38 -0800
From:      Gary Kline <kline@thought.org>
To:        Ian Smith <smithi@nimnet.asn.au>
Cc:        perryh@pluto.rain.com, freebsd-questions@freebsd.org
Subject:   Re: regex question....
Message-ID:  <20101205101338.GA13114@thought.org>
In-Reply-To: <20101205194739.U20283@sola.nimnet.asn.au>
References:  <20101205073614.AE4C01065785@hub.freebsd.org> <20101205194739.U20283@sola.nimnet.asn.au>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Dec 05, 2010 at 07:56:30PM +1100, Ian Smith wrote:
> In freebsd-questions Digest, Vol 339, Issue 11, Message: 30
> On Sat, 4 Dec 2010 18:23:08 -0800 Gary Kline <kline@thought.org> wrote:
>  > 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.
> 
> 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

	Well, sorry, this is part of my text-to-speech stuff and I admit
	to be stuck in C.  [Heart-throb.]

	It was late last August when we were all sweltering and I
	mentioned having had a file of 130 :abbrvs that fit vi.
	Somebody said that he would like  to see my list and a search
	couldn't find it.  I did find lists of the top-N most frequently
	used words in English, but the  rest of it was gone.  

	I Spent a few hours today re-creating the abbreviations as they
	were back in the late 90's.  Back then I was interested in
	saving my keystrokes.  So that I might type: "i wll kEp trak v m
	hrs evry wk." and vi would translate that to "I will keep track
	of my hours every week."   Overall, tests found that  clever
	abrevs would save around 31% if you learns ~130 words.  

	Now my goal is to output words that festival and ktts will turn
	into sounds.  This will let me use homonyms, since the output
	will be spoken rather than read.  So "thr taking thr stuf ovr
	the." would translate to: "They're taking their stuf over
	there."

	Anybody interested in this, please take it Off-Line, okay.

	And thax for yer regex help :-)

	gary



-- 
 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?20101205101338.GA13114>