POV-Ray : Newsgroups : povray.off-topic : Really strange design choices : Re: Trixy Server Time
6 Sep 2024 21:19:38 EDT (-0400)
  Re: Trixy  
From: Warp
Date: 18 Dec 2008 12:22:16
Message: <494a86c7@news.povray.org>
Invisible <voi### [at] devnull> wrote:
> >     ^[+-]?([0-9]+\.?|[0-9]*\.[0-9]+)(e[+-]?([0-9]+\.?|[0-9]*\.[0-9]+))?$

> ...which would be incorrect then, for at least the following reasons:

> - There can be *zero* or more characters before the decimal point.

  Which is exactly what "[0-9]*\." means: Zero or more digits, followed
by the dot character.

> - The "e" can also be "E".

  That's easy to fix: Replace "e" in the regexp with "[eE]".

> - The exponent is an integer, not a real.

  Then it becomes simpler:

    ^[+-]?([0-9]+\.?|[0-9]*\.[0-9]+)([eE][+-]?[0-9]+)?$

  In fact, that pattern actually matches the floating point number
representation in C and C++ (except perhaps for possibility of a
preceding +).

> See? Not as easy as it looks, is it?

  It was not a question of difficulty. It was a question of me not knowing
the exact format of floating point numbers in PostScript and making
assumptions.

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.