<div dir="auto"><div dir="auto">What about expanding the validation to multiple regexes which all need to match to check for illegal values where necessary ?</div><div dir="auto"><br></div><div dir="auto"><span style="font-family:sans-serif">first: !((0|0.0*|.0+)\s+){3})*</span><br></div><div dir="auto"><span style="font-family:sans-serif"><br></span></div><div dir="auto">second: actual SFRotation pattern</div><div dir="auto"><br></div><div dir="auto">Can there be multiple regexes in the XML Schema for a type ?</div><div dir="auto"><br></div><div dir="auto"><br></div><div>SFImage regex considerations:<div dir="auto"><br></div><div dir="auto">Are hex values allowed for width etc. ? The spec. only says integer but perhaps decimal is implied.</div><div dir="auto"><br></div><div dir="auto">Can hex. values use any case for letters ? The descriptions only use capitals as 0xFF. Is 0Xff also valid ?</div><div dir="auto"><br></div><div dir="auto">0 0 0 is the default value. But should 0 be allowed for components in any other case ?</div><div dir="auto"><br></div><div dir="auto">No leading 0s for integer values.</div><div dir="auto"><br></div><div dir="auto">But 0x0000FF is OK.</div><div dir="auto"><br></div><div dir="auto">No negative integers for width etc.</div><div dir="auto"><br></div><div dir="auto">Perhaps allow negative values for color: 255 = -1 for single component, for example.</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br><div data-smartmail="gmail_signature" dir="auto">-- AP on the road</div></div><br><br><div class="gmail_quote"><div dir="ltr">On Fri, Aug 17, 2018, 3:15 PM Don Brutzman <<a href="mailto:brutzman@nps.edu">brutzman@nps.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">details follow on current regex progress.<br>
<br>
On 8/7/2018 8:21 AM, Don Brutzman wrote:<br>
> [...]<br>
> <a href="http://www.web3d.org/specifications/X3dRegularExpressions.html#Design" rel="noreferrer noreferrer" target="_blank">http://www.web3d.org/specifications/X3dRegularExpressions.html#Design</a><br>
> <a href="http://www.web3d.org/specifications/X3dRegularExpressions.png" rel="noreferrer noreferrer" target="_blank">http://www.web3d.org/specifications/X3dRegularExpressions.png</a><br>
> <br>
> Continuing:<br>
> <br>
> On 8/6/2018 11:52 AM, Andreas Plesch wrote:<br>
>> Two quick points:<br>
>><br>
>> The hexadecimal pattern got corrupted. SFImage uses this pattern:<br>
>><br>
>> 0x([a-f]|[A-F]|\d]){1,8}<br>
>><br>
>> where \d is the digit character class.<br>
> <br>
> Thanks, will work on that pattern next.<br>
<br>
Currently using 0x[0-9a-fA-F]{1,8} for hexadecimal value, from Regular Expressions Cookbook.<br>
<br>
Preliminary pattern for SFImage is there, but also need to allow integers as alternatives for hex values.<br>
<br>
>> There are two equivalent +- patterns<br>
>> (\+|\-)?<br>
>> [+|-]?<br>
>> Probably only one should be recommended and used subsequently.<br>
> <br>
> Good catch, thank you.  Will scrutinize and normalize.<br>
<br>
[+-]? for sign and [Ee] for scientific-notation exponent.<br>
<br>
>> I have no good idea how to detect a leading 0 0 0 as non-matching. My<br>
>> not so good idea would be to explicitly allow<br>
>> non-0 followed by x x or<br>
>> x followed by non-0 followed by x or<br>
>> x x followed by non-0<br>
>><br>
>> where non-0 is something [+-]?0?\.?[0-9]*[1-9]+[0-9]*([e|E][+-]?[0-9]+)*<br>
>> and x is a floating point number<br>
>><br>
>> -Andreas<br>
> <br>
> Possibly, but am thinking it adds serious complexity that is hard to maintain.  So probably not but will think about it.<br>
<br>
It is great when we find those patterns, am trying to keep things maintainable.  The color-coding on web page definitely helps.<br>
<br>
Negative lookahead is good for avoiding illegal values, but not allowed in XML Schema (probably to avoid computational denial of service attacks_.  Have listed a pattern nevertheless, other languages/tools might want to use it.<br>
<br>
==================<br>
Disallowed values:<br>
<br>
* Negative lookahead filters can disqualify attributes that contain illegal values.<br>
* W3C Recommendation for XML Schema (XSD) unfortunately does not support this construct.<br>
* (?!((0|0.0*|.0+)\s+){3}) prohibits 0 0 0 since zero vector is illegal as initial axis triplet of an SFRotation.<br>
* (?!\s*,\s*,) prohibits multiple adjacent commas in intermediate whitespace, for example 0 0 0, ,0 0 0 is an illegal set of MFColor values.<br>
==================<br>
<br>
> Thanks for the continuing review!  Very helpful.<br>
Steadily better and better... need to check each regex101 unit test to make sure properly updated.  SF/MFImage are next, then matrix types.<br>
<br>
all the best, Don<br>
-- <br>
Don Brutzman  Naval Postgraduate School, Code USW/Br       <a href="mailto:brutzman@nps.edu" target="_blank" rel="noreferrer">brutzman@nps.edu</a><br>
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149<br>
X3D graphics, virtual worlds, navy robotics <a href="http://faculty.nps.edu/brutzman" rel="noreferrer noreferrer" target="_blank">http://faculty.nps.edu/</a>brutzman<br>
</blockquote></div></div></div>