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

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

Thread Next
October 13, 2017 06:11
Re: [perl #132278] perlbug AutoReply: looks_like_number returns trueon "- "
Message ID:
2017-10-12 14:38:27 -0700,
> It seems like the intention is for it to match on
> ^\s*((?i:[-+]\d*\.?\d+(e[-+]?\d+)?|inf(inity)?|nan)|0 but true)\s*$
> though it's hard to tell for sure from the source.

Sorry, it's probably more like:

^((?i:\s*[-+]?(\d*[$r.]?\d+(e[-+]?\d+)?|inf(inity)?|nan)\s*)|0 but true)$

as nan/inf can have a sign, but "0 but true" has to be exactly
like that (no sign or surrounding whitespace). (there were a few
more basic errors in my previous approximation, sorry it was

$r is the locale's radix character under "use locale"¹ ("." is
still supported even if the locale uses another one). While the
\s seems to be only the ASCII white space (not U+2006 for
instance regardless of the locale).

¹ while it works on GNU/Linux, someone reports the radix
character is not honoured on OpenBSD:


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About