[x3d-public] SFImage regex

Don Brutzman brutzman at nps.edu
Mon Jun 11 06:45:21 PDT 2018


Sounds sensible.  I suspect performance is not impacted whatsoever since regex patterns tend to get precompiled... but we'll see.  Getting the expressions right is our first priority, optimization (if relevant) can follow in the future.


On 6/9/2018 10:43 AM, Andreas Plesch wrote:
> On Sat, Jun 9, 2018 at 1:19 PM, Don Brutzman <brutzman at nps.edu> wrote:
>> good point... i've been grouping them just to keep the regexes a slight bit
>> more readable, less possibility of error.  we could do cleanup of those
>> (group) parentheses if it is preferable.
> 
> The parens do look more readable, at least to the casual regex reader.
> Parens usually are used for capturing, eg. referencing the matched
> group later although I am not sure if this is possible with XML
> regexes which seem more basic. To regex regulars parens therefore may
> cause human interpreters to look for those references. Also - at least
> outside of XML - performance may be impacted from using a lot of
> grouping.
> 
> Probably best to just leave the parens.
> 
> Tangentially, repeated ranges also look not so nice but are apparently
> common: [0-9a-fA-F]
> [0-9]|[a-f|[A-F] reads better to me and that is why I preferred that.
> Not sure about any performance implications.
> 
> -Andreas
> 
>>
>> On 6/9/2018 8:45 AM, Andreas Plesch wrote:
>>>
>>> On Sat, Jun 9, 2018 at 8:30 AM, Don Brutzman <brutzman at nps.edu> wrote:
>>>>
>>>> On 6/8/2018 3:13 PM, Don Brutzman wrote:
>>>>>
>>>>>
>>>>>
>>>>> *  These regexes all assume that leading/trailing whitespace has been
>>>>> removed. It is possible to prepend/append regex constructs such as (\s)+
>>>>> to
>>>>> consume outer whitespace.
>>>>
>>>>
>>>>
>>>> correction: zero or more whitespace characters (\s)* rather than one or
>>>> more
>>>> whitespace characters (\s)+
>>>
>>>
>>> Yes, but it is not necessary to group the \s class: \s*. I am not sure
>>> if prepending/appending is preferable to using the collapse whitepace
>>> XML restriction. Since there are more fluent regex than XML readers,
>>> it may be.
>>>
>>> -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/brutzman
>>
> 
> 
> 


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




More information about the x3d-public mailing list