[x3d-public] X3D Regex
Andreas Plesch
andreasplesch at gmail.com
Thu Jun 7 05:01:50 PDT 2018
Hi Don
On Thu, Jun 7, 2018, 12:17 AM Don Brutzman <brutzman at nps.edu> wrote:
> great to see the dialog and scrutiny, thanks!
>
> intent is to allow legal/standard content but disallow (or at least
> diagnose) broken/problematic/nonstandard content.
>
I think it may be helpful to more definitely state what the function of the
regex is:
- flag certainly broken content but still allow questionable content
- only allow well behaved content and flag questionable but parseable and
possibly legal content
There could be two versions, strict and lax.
> for MFInt32,
>
> - legal: 0 1 2 30 -0 -1 -2 -30
>
> - illegal: 010 -020 (leading zeroes also an indicator that intermediate
> whitespace was dropped)
>
The official regex /((\+|\-)?(0|[1-9][0-9]*)?( )?(,)?( )?)*/ currently
allows leading zeros as legal, perhaps by accident.
> - single comma OK between numbers, but multiple commas an indicator that
> an intermediate number was dropped
>
The official regex currently allows multiple commas.
Other patterns to clarify as being considered problematic include:
- +0
- -0
- + 12 (white space after sign)
- tab,newline,return as white space
- capital letters for hex: 0xAF
- 0X in addition to 0x as prefix for hexadecimal
> I have the O'Reilly books on this topic, they often give good/adaptable
> "cookbook recipes" worth considering. can look further next week.
>
> it is helpful to be very wary of any conclusions whatsoever without
> testing a regex.
>
Oh yes.
>
> if alternatives are found, great - we can test with online tools, with
> Netbeans/X3D-Edit, and with regression testing of the X3D Examples Archive.
>
It sounds like the current regex does not quite match expectations.
The archive may not have leading zeros anywhere ? Or some of the other
problematic patterns like multiple commas ?
-Andreas
> 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/brutzma
> n
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20180607/aa8ff832/attachment.html>
More information about the x3d-public
mailing list