Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #10412
| From | Dr J R Stockton <reply1203@merlyn.demon.co.uk> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: JavaScript Regex |
| Date | 2012-01-19 20:11 +0000 |
| Organization | Home |
| Message-ID | <NmnMAXM+jHGPFwkK@invalid.uk.co.demon.merlyn.invalid> (permalink) |
| References | <8kosg7tha6n6epo47krtaulm9a269kvclo@4ax.com> <Vcoq+cHIJfEPFw0l@invalid.uk.co.demon.merlyn.invalid> <c4c7h7t2qghi49i0esm44sl00ki2cq27q9@4ax.com> <feDIOqHgOdFPFw8W@invalid.uk.co.demon.merlyn.invalid> <fcf854ac-2bf2-45c9-b458-28f5b07b2c12@i6g2000vbk.googlegroups.com> |
In comp.lang.javascript message <fcf854ac-2bf2-45c9-b458-28f5b07b2c12@i6 g2000vbk.googlegroups.com>, Wed, 18 Jan 2012 05:42:13, Scott Sauyet <scott.sauyet@gmail.com> posted: >Dr J R Stockton wrote: >> Gene Wirchenko posted: >>> Dr J R Stockton wrote: >>>> Gene Wirchenko posted: >>>>> I wish to parse a string to see if it is a valid fixed-decimal >>>>> value. >>>> >>>> Cannot actually be done. "2012" may in truth be 2^8+1, to base 5. >>> >>> How fatuous and condescending! I am checking whether a string is >>> valid fixed-decimal value. >> >> No, you are checking whether it can be interpreted as a valid integer or >> fixed-point decimal value. One cannot tell what a string IS by mere >> inspection of the string. > >Did you really misunderstand? Or are you being pedantic for no good >reason? I know more or less what he meant, but it was expressed in a woolly- minded manner. Those are not exact descriptions of what he wants to test for. Before designing such a test, it is necessary to know what characters, if any, can be present before or after the number; whether a sign is permissible or compulsory or neither, whether a fixed-point number is required to have a point in it, whether there must be a digit on each side of the point or it is allowable to have a digit on only one side, whether starting with <zero><digit> is allowed, whether there should be any bound on the magnitude, whether there may be thousands separators (or ones for lakhs & crores, to support the Indian market), etc. AFAIK, the Canadian Government of Canada (or of Quebec) may impose a requirement to accept also comma as the decimal separator. Those who express their needs fully, clearly, and unambiguously may well realise the solution while doing so, and otherwise are likely to get useful, accurate answers. >Now, on the other hand, Gene, the first result in > > http://www.google.com/search?q=javascript+regex+floating+point > >is to a Stack Overflow page which has this answer: > > /^[-+]?[0-9]*\.?[0-9]+$/ > >That might or might not meet your requirements (it allows leading >zeroes and bare decimals), but it could at least be a good starting >point. And it wasn't hard to find. The answers on my page would have been easy to find, at least after I gave the URL. And I know about \d. -- (c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME. Web <http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms and links; Astro stuff via astron-1.htm, gravity0.htm ; quotings.htm, pascal.htm, etc. No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll 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