develooper Front page | perl.perl5.porters | Postings from October 2017

Re: [perl #132278] perlbug AutoReply: looks_like_number returns trueon "- "

Thread Previous
From:
Stephane CHAZELAS
Date:
October 13, 2017 15:59
Subject:
Re: [perl #132278] perlbug AutoReply: looks_like_number returns trueon "- "
Message ID:
20171013112443.GC7775@chaz.gmail.com
2017-10-13 06:42:20 +0100, Stephane CHAZELAS:
[...]
> Sorry, it's probably more like:
> 
> ^((?i:\s*[-+]?(\d*[$r.]?\d+(e[-+]?\d+)?|inf(inity)?|nan)\s*)|0 but true)$
[...]

OK, looking at the code, there's a lot more. At least

qr{^(
    (?i:
       \s*[-+]?(
         \d*[$r.]?\d+(e[-+]?\d+)?|
         inf(inity)?|
         (1\.?\#)?[qs]?nan[qs]?(\((
	   \d+|
	   0x[\da-f]+|
	   0b[0-1]+
	 )\))?|
         1\.?\#(infinity|in[fd]0*)
       )\s*
    )|0\ but\ true
  )$}x

matching on things like:

+1.#nan(0xbeef)

Probably not exhaustive. I'll leave it there.

-- 
Stephane

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About