Re: aterm

Simon Drabble (simond@foxlink.net)
Wed, 14 Apr 1999 09:46:09 -0400 (EDT)


On Wed, 14 Apr 1999, Greg Anderson wrote:

> Sasha Vasko wrote:
> > 
> > There are terminfo and xresources  files provided in aterm's
> > distro in doc/etc directory
> > See if you could use those.
> > 
> > Also consult the following page for some help :
> > http://www.ibbnet.nl/~anne/keyboard/keyboard.html#X
> 
> Thank you! what a great resource the ~anne/keyboard pages are.
> It's an information ocean out there not a highway.  I love it
> when gems like this one float in with the tide.
> 
> Does anyone have a regular expression that would identify this:
> [+|-]digit
> Testing for a digit or a leading + or - is easy, but I can't 
> come up with a regular expression that will identify a string
> as a digit that may or may not have a leading plus or minus sign.
> Thanks.

Try:

(([+-][0-9]+)|([0-9]+))

which will match integers of any length with optional leading +|-.

Floating-point numbers are a little harder since, e.g. perl will match
them as an integer with the regexp above.

If you were testing whether a string is _only_ a number (i.e. does not
contain alpha or punct characters other than `.') then you could put a $
at the end of the above regexp. - testing for fp's would be easier then
with something like:

(([+-][0-9]+[.][0-9]*)|([0-9]+[.][0-9]*))$

Note: I have tested the above in Perl's regexp engine - other parsers may
be different. YMMV.

If there's a more elegant solution out there please share it with us.


Simon.




> 
> -- 
> 
> Greg Anderson
> http://www.FutureRealms.com/
> 
> --
>    WWW:   http://www.afterstep.org/
>    FTP:   ftp://ftp.afterstep.org/
>    MAIL:  http://www.caldera.com/linuxcenter/forums/afterstep.html
> 
> 

-- 
 "The real reason Heisenberg and Schrodinger didn't get along is because,
  unknown to many historians, Heisenberg had a dog."
   
   Simon Drabble                      Somewhere in cyberspace


--
   WWW:   http://www.afterstep.org/
   FTP:   ftp://ftp.afterstep.org/
   MAIL:  http://www.caldera.com/linuxcenter/forums/afterstep.html