> -----Original Message-----
> From: netmod <[email protected]> On Behalf Of Juergen Schoenwaelder
> Sent: 13 June 2019 15:07
> To: Robert Varga <[email protected]>
> Cc: NETMOD WG <[email protected]>
> Subject: Re: [netmod] regular expression flavours (again)
> 
> >
> > Can we engineer a workable solution for the general case without
> > getting everyone know the differences in RE engines? Something along
> > the lines of this:
> > https://github.com/openconfig/public/issues/44#issuecomment-501629497
> > perhaps?
> 
> Please lets not (even with the best intentions) create yet another regular
> expression flavour.

Sorry, but I still think that is exactly what we should do. 😊

What we have today is seemingly not working for the industry:

Some implementations might link against the libxml2 regex engine.  Great, they 
are compliant with IETF YANG models, but not OpenConfig.

Perhaps there are some other implementations that have written their own XML 
regex engine for the language of their choice.  I suspect that there are few in 
this camp!

For everyone else, I think that they do what OpenConfig is trying to do, and 
they just throw the pattern statements into their chosen language's default 
regex engine.  And the thing is, assuming the beginning/end anchors are handled 
appropriately, I suspect that this works for 99% of the pattern statements in 
YANG models.

OpenConfig state that they are using POSIX regex, with the expectation that 
these regular expressions can just be interpreted by most languages.  
Unfortunately, that isn't quite true either, seemingly most languages are 
derived from PCRE, and there is a minor difference on how '\' is handled within 
a character group.  There also seems to be a difference of first vs longest 
match for alternation, but I'm not convinced that matters for pattern 
statements.  Finally, POSIX ERE regex is only defined by ASCII, and doesn't 
cover Unicode, so isn't a great choice for YANG.

Personally, I think that standardizing a basic regex language that is a common 
subset of what the common languages implement would probably be beneficial in 
the industry in general.

I'm sure that someone can post an XKCD of why this is a bad idea 😉

Thanks,
Rob


> 
> /js
> 
> --
> Juergen Schoenwaelder           Jacobs University Bremen gGmbH
> Phone: +49 421 200 3587         Campus Ring 1 | 28759 Bremen | Germany
> Fax:   +49 421 200 3103         <https://www.jacobs-university.de/>
> 
> _______________________________________________
> netmod mailing list
> [email protected]
> https://www.ietf.org/mailman/listinfo/netmod
_______________________________________________
netmod mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/netmod

Reply via email to