[x3d-public] X3D regexes for colorRGBA, image need work

Andreas Plesch andreasplesch at gmail.com
Sat Jul 21 15:41:15 PDT 2018


I added some more unit tests and comments here:

https://regex101.com/r/R3LXnN/2

The same regex would work for SFColor with {2} repetitions instead of {3}.

It looks like the original regex allowed for positive exponents as
long as the mantissa was <1. But this would allow 0.9e99. It also did
not match 10e-3, I think, which may actually occur.




On Sat, Jul 21, 2018 at 4:37 PM Andreas Plesch <andreasplesch at gmail.com> wrote:
>
> I started from scratch and came up with this regex:
>
> https://regex101.com/r/R3LXnN/1/tests
>
> I also added a tricky unit test case which has 10e-3 as a valid but
> hard to validate value. I cannot see how a regex can catch that but
> still try to enforce the <=1.0 condition.
>
> Similary, 0.0001e+3 would be hard to validate but valid even though
> unusual. Currently, the regex above does not allow for any positive
> exponents.
>
> So perhaps the regex should not try and just accept all numbers with
> scientific notation, regardless of their value ? Currently, the regex
> is strict and will only <= 1.0 values.
>
> -Andreas
>
>
> On Sat, Jul 21, 2018 at 1:18 PM <x3d-public-request at web3d.org> wrote:
> >
> > Send x3d-public mailing list submissions to
> >         x3d-public at web3d.org
> >
> > To subscribe or unsubscribe via the World Wide Web, visit
> >         http://web3d.org/mailman/listinfo/x3d-public_web3d.org
> > or, via email, send a message with subject or body 'help' to
> >         x3d-public-request at web3d.org
> >
> > You can reach the person managing the list at
> >         x3d-public-owner at web3d.org
> >
> > When replying, please edit your Subject line so it is more specific
> > than "Re: Contents of x3d-public digest..."
> >
> >
> > Today's Topics:
> >
> >    1. Re: X3D regexes for colorRGBA, image need work (Don Brutzman)
> >
> >
> > ----------------------------------------------------------------------
> >
> > Message: 1
> > Date: Sat, 21 Jul 2018 10:17:10 -0700
> > From: Don Brutzman <brutzman at nps.edu>
> > To: X3D Graphics public mailing list <x3d-public at web3d.org>
> > Subject: Re: [x3d-public] X3D regexes for colorRGBA, image need work
> > Message-ID: <5f45b810-826f-9182-21b0-8873f0aa5f4a at nps.edu>
> > Content-Type: text/plain; charset="utf-8"; Format="flowed"
> >
> > following Andreas' earlier example, have added some regex tests for SFColorRGBA to regex101.com (it allows login using github account).
> >
> > SFColorRGBA tests for default value pass but illegal values (including empty value) are incorrectly accepted, leading to RED test failure.  screenshot attached, clearly something is awry.
> >
> > https://regex101.com/r/sy4qJ7/1
> >
> > http://www.web3d.org/specifications/X3dRegularExpressions.html#SFColorRGBA
> >
> > On 6/28/2018 8:45 PM, Don Brutzman wrote:
> > > Newly installed X3DJSAIL tests reveal:
> > >
> > > SFColorRGBAObject.initialize() problem: failed to match default value DEFAULT_VALUE [F at 481ba2cf
> > > MFColorRGBAObject.initialize() problem: failed to match default value DEFAULT_VALUE [F at 12d2ce03
> > > SFImageObject.initialize() problem: failed to match default value DEFAULT_VALUE [I at 6239aba6
> > > MFImageObject.initialize() problem: failed to match default value DEFAULT_VALUE [I at 4f3bbf68
> > >
> > > Regexes can be found in schema documentation for each? Simple type at
> > >
> > > http://www.web3d.org/specifications/X3dSchemaDocumentation4.0/x3d-4.0.html
> > >
> > > and further documented at
> > >
> > > http://www.web3d.org/specifications/X3dRegularExpressions.html#SFColorRGBA
> > > http://www.web3d.org/specifications/X3dRegularExpressions.html#SFImage
> > >
> > > Anyone want to tackle these?
> > all the best, Don
> > --
> > Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
> > Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
> > X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman
> > -------------- next part --------------
> > A non-text attachment was scrubbed...
> > Name: RegexTestsSFcolorRGBA.png
> > Type: image/png
> > Size: 63284 bytes
> > Desc: not available
> > URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20180721/68fb490f/attachment.png>
> >
> > ------------------------------
> >
> > Subject: Digest Footer
> >
> > _______________________________________________
> > x3d-public mailing list
> > x3d-public at web3d.org
> > http://web3d.org/mailman/listinfo/x3d-public_web3d.org
> >
> >
> > ------------------------------
> >
> > End of x3d-public Digest, Vol 112, Issue 43
> > *******************************************
>
>
>
> --
> Andreas Plesch
> Waltham, MA 02453



-- 
Andreas Plesch
Waltham, MA 02453



More information about the x3d-public mailing list