[x3d-public] X3D Regex

Andreas Plesch andreasplesch at gmail.com
Wed Jun 6 10:37:52 PDT 2018


> Date: Wed, 6 Jun 2018 09:23:09 -0700
> From: Don Brutzman <brutzman at nps.edu>
> To: X3D Graphics Working Group <x3d at web3d.org>
> Cc: X3D Graphics public mailing list <x3d-public at web3d.org>, "Humanoid
>         Animation (H-Anim) Working Group" <h-anim at web3d.org>
> Subject: [x3d-public] X3D teleconference 5 JUN 2018 minutes: HAnim
>         DIS, X3D Regex, Web3D 2018 and X3Dv4
>
...
>         X3D Regular Expressions (regexes)
>         http://www.web3d.org/specifications/X3dRegularExpressions.html
>
> Vince reports that MFInt32 problem stack-overflow error still remains when running X3D Schematron locally.  He will post the abridged example that is still failing, hopefully that will help our test efforts.
>
> MFInt32 regex pattern:
>
>         ((\+|\-)?(0|[1-9][0-9]*)?( )?(,)?( )?)*
>         http://www.web3d.org/specifications/X3dRegularExpressions.html#MFInt32

I am looking at this regex and have a few questions.

All groups are optional, so it seems to also match an empty string "".
Perhaps not a problem, or even intentional.

It matches a mix of commas and spaces, for example ",,,  , ,, ,,  ".
This does not look like an acceptable MFInt32 value.

The second group (0|[1-9][0-9]*) : This is harder to understand. It
seems to want to address leading zeros. Why not just use ([0-9]*) ?
Using https://regexr.com/ and https://regex101.com/ I could not come
up with a pattern where these expressions were not equivalent. What
would be an example where ([0-9]*) would not work ?

http://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/EncodingOfFields.html#SFInt32
allows hexadecimal values, using 0x prefix. I have never seen this but
the regex would not match, eg. produces a false negative.


-Andreas

-- 
Andreas Plesch
Waltham, MA 02453



More information about the x3d-public mailing list