Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #10176

Re: JavaScript Regex

Newsgroups comp.lang.javascript
Subject Re: JavaScript Regex
From "Evertjan." <exjxw.hannivoort@interxnl.net>
References <8kosg7tha6n6epo47krtaulm9a269kvclo@4ax.com> <4f0ef6b7$0$30370$a8266bb1@newsreader.readnews.com> <6913494.xuaST5U3oO@PointedEars.de>
Message-ID <Xns9FD8AE7EA5FF1eejj99@194.109.133.133> (permalink)
Date 2012-01-12 16:09 +0000

Show all headers | View raw


Thomas 'PointedEars' Lahn wrote on 12 jan 2012 in comp.lang.javascript:

> Denis McMahon wrote:
> 
>> On Wed, 11 Jan 2012 20:51:26 -0800, Gene Wirchenko wrote:
>>>      I wish to parse a string to see if it is a valid fixed-decimal
>>> value.
>> 
>> /^[+-]?\d{1,}(\.\d*)?$/
>> 
>> http://www.sined.co.uk/tmp/regex.htm
> 
> Wrong, see the ECMAScript Language Specification and, e. g., the JSON 
> website.  And what is *fixed* about this?
> 
>   !isNaN(+s)

Will also accept "2.2e7" which is not a fixed-decimal but floating.

There is no need for the +, as isNaN() will accept a string,
and do the conversion internally.

> where `s' is a String value, suffices for strings representing
> floating- point values.  If "fixed" is supposed to mean "a fixed
> number of decimals", a more elaborate expression needs to be used, but
> not this one (what about leading "." and scientific notation?).  We
> have been over this. 



-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

JavaScript Regex Gene Wirchenko <genew@ocis.net> - 2012-01-11 20:51 -0800
  Re: JavaScript Regex Ross McKay <au.org.zeta.at.rosko@invalid.invalid> - 2012-01-12 17:07 +1100
    Re: JavaScript Regex Gene Wirchenko <genew@ocis.net> - 2012-01-12 12:13 -0800
      Re: JavaScript Regex "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-01-12 20:48 +0000
        Re: JavaScript Regex Dr J R Stockton <reply1202@merlyn.demon.co.uk> - 2012-01-14 20:41 +0000
          Re: JavaScript Regex "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-01-15 20:08 +0000
            Re: JavaScript Regex Dr J R Stockton <reply1203@merlyn.demon.co.uk> - 2012-01-16 21:55 +0000
  Re: JavaScript Regex Denis McMahon <denismfmcmahon@gmail.com> - 2012-01-12 15:05 +0000
    Re: JavaScript Regex Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-01-12 16:42 +0100
      Re: JavaScript Regex "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-01-12 16:09 +0000
    Re: JavaScript Regex "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-01-12 15:56 +0000
      Re: JavaScript Regex Dr J R Stockton <reply1202@merlyn.demon.co.uk> - 2012-01-14 20:44 +0000
      Re: JavaScript Regex Dr J R Stockton <reply1203@merlyn.demon.co.uk> - 2012-01-19 19:59 +0000
        Re: JavaScript Regex "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-01-20 09:19 +0000
          Re: JavaScript Regex Dr J R Stockton <reply1203@merlyn.demon.co.uk> - 2012-01-21 20:27 +0000
  Re: JavaScript Regex Dr J R Stockton <reply1202@merlyn.demon.co.uk> - 2012-01-14 21:23 +0000
    Re: JavaScript Regex Gene Wirchenko <genew@ocis.net> - 2012-01-15 21:10 -0800
      Re: JavaScript Regex Dr J R Stockton <reply1203@merlyn.demon.co.uk> - 2012-01-17 20:01 +0000
        Re: JavaScript Regex Scott Sauyet <scott.sauyet@gmail.com> - 2012-01-18 05:42 -0800
          Re: JavaScript Regex Dr J R Stockton <reply1203@merlyn.demon.co.uk> - 2012-01-19 20:11 +0000

csiph-web