Re: [netmod] Potential additions to rfc6087bis: RegEx guidelines
Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de> Thu, 24 August 2017 06:09 UTC
Return-Path: <j.schoenwaelder@jacobs-university.de>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id EA874126E64 for <netmod@ietfa.amsl.com>; Wed, 23 Aug 2017 23:09:07 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level:
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EIfvDCqPc9VX for <netmod@ietfa.amsl.com>; Wed, 23 Aug 2017 23:09:05 -0700 (PDT)
Received: from atlas5.jacobs-university.de (atlas5.jacobs-university.de [212.201.44.20]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 04EED12426E for <netmod@ietf.org>; Wed, 23 Aug 2017 23:09:05 -0700 (PDT)
Received: from localhost (demetrius5.irc-it.jacobs-university.de [10.70.0.222]) by atlas5.jacobs-university.de (Postfix) with ESMTP id D169669; Thu, 24 Aug 2017 08:09:03 +0200 (CEST)
X-Virus-Scanned: amavisd-new at jacobs-university.de
Received: from atlas5.jacobs-university.de ([10.70.0.217]) by localhost (demetrius5.jacobs-university.de [10.70.0.222]) (amavisd-new, port 10032) with ESMTP id U5-ciEWqzcXt; Thu, 24 Aug 2017 08:09:02 +0200 (CEST)
Received: from hermes.jacobs-university.de (hermes.jacobs-university.de [212.201.44.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "hermes.jacobs-university.de", Issuer "Jacobs University CA - G01" (verified OK)) by atlas5.jacobs-university.de (Postfix) with ESMTPS; Thu, 24 Aug 2017 08:09:03 +0200 (CEST)
Received: from localhost (demetrius2.jacobs-university.de [212.201.44.47]) by hermes.jacobs-university.de (Postfix) with ESMTP id 8E648200E2; Thu, 24 Aug 2017 08:09:03 +0200 (CEST)
X-Virus-Scanned: amavisd-new at jacobs-university.de
Received: from hermes.jacobs-university.de ([212.201.44.23]) by localhost (demetrius2.jacobs-university.de [212.201.44.32]) (amavisd-new, port 10024) with ESMTP id 974HKAXZuH0n; Thu, 24 Aug 2017 08:09:02 +0200 (CEST)
Received: from elstar.local (elstar.jacobs.jacobs-university.de [10.50.231.133]) by hermes.jacobs-university.de (Postfix) with ESMTP id D18AF200E0; Thu, 24 Aug 2017 08:09:02 +0200 (CEST)
Received: by elstar.local (Postfix, from userid 501) id BFFB0404AAEB; Thu, 24 Aug 2017 08:09:00 +0200 (CEST)
Date: Thu, 24 Aug 2017 08:09:00 +0200
From: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
To: Xufeng Liu <Xufeng_Liu@jabil.com>
Cc: "'netmod@ietf.org'" <netmod@ietf.org>
Message-ID: <20170824060900.u5kcffzvwjr7mmob@elstar.local>
Reply-To: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
Mail-Followup-To: Xufeng Liu <Xufeng_Liu@jabil.com>, "'netmod@ietf.org'" <netmod@ietf.org>
References: <BN3PR0201MB0867DAD1212DBA2E88570AD5F1850@BN3PR0201MB0867.namprd02.prod.outlook.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <BN3PR0201MB0867DAD1212DBA2E88570AD5F1850@BN3PR0201MB0867.namprd02.prod.outlook.com>
User-Agent: NeoMutt/20170714 (1.8.3)
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/OsZSefLvT9uYtR1Hcj9Od6rdJCI>
Subject: Re: [netmod] Potential additions to rfc6087bis: RegEx guidelines
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: NETMOD WG list <netmod.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netmod>, <mailto:netmod-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netmod/>
List-Post: <mailto:netmod@ietf.org>
List-Help: <mailto:netmod-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netmod>, <mailto:netmod-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 24 Aug 2017 06:09:08 -0000
On Wed, Aug 23, 2017 at 09:20:36PM +0000, Xufeng Liu wrote: > Members of Routing Area Yang DT have had some discussions about the handling of various variants of regular expressions. The followings are the current state, and we are thinking that if this topic can be added to RFC6087bis: > > 1. Regular Expression Usage > YANG uses regular expressions to restrict string values. Such a restriction can be a part of a "pattern" statement or a string matching function. [RFC7950] specifies that YANG regular expressions will conform to Appendix F in [XSD-TYPES]. > YANG models have been implemented in many different environments and the XSD variant of the regular expressions is not supported in many of these environments. There are currently more than a dozen popular regular expression variants implemented in various environments. While the usage of the XSD variant of regular expression described in [RFC7950] remains the preferred standard, a few conventions are prescribed to maximize the portability of YANG models between environments. > I strongly disagree with this statement. The standard format are XSD regular expressions. RFC 7950 section 9.4.5: The "pattern" statement, which is an optional substatement to the "type" statement, takes as an argument a regular expression string, as defined in [XSD-TYPES]. There is no notion of a 'preferred' standard. > 1.1. Regular Expression Variant Choice Precedence > YANG model designers SHOULD use the most portable syntax whenever possible. Under the condition that XSD compliance is satisfied and there are multiple choices for a given expression, the following precedence SHOULD be used to choose a regular expressions variant: > > o POSIX base > > o POSIX extended > > o BSD > > o GNU Regular Expression Extensions > > o C++ Regular Expressions with std::regex > > o Others Strongly disagree. You either write YANG or something different. There is no way to recognize what kind of regular expressions have been used by the model designer. The value of a standard is that everybody does the same. > For example, either \d or [0-9] can be used with equivalent semantics and they are both compliant to [XSD-TYPES]. [0-9] is recommended because [0-9] is supported by POSIX base but \d is not. > > 1.2. Convention Guidelines > 1.2.1. Avoid Character Category Escapes > For example, in XSD regular expression, \d is a Character Category Escape denoting the range of digits, i.e., [0-9]. To maximize portability, the model designers SHOULD use [0-9] instead of \d. > > 1.2.2. Avoid Unicode Characters > Unicode characters are allowed in XSD regular expressions, but are not supported in the POSIX variant. If possible, the model designers SHOULD avoid using Unicode characters, such as: \p{L} and \p{N}. > > 1.3. Conversion Tools > Tools can automatically convert regular expressions from one variant to another. When a YANG model is implemented in an environment where XSD regular expressions are not supported, the recommended approach is to use a conversion tool. For example, if needed, anchor position characters, i.e., '^' and '$', can be added by a regular expression conversion tool. If conversion tools exist that can convert, then by all means use XSD in the YANG model and use tools to convert to whatever format your implementation prefers to use. /js -- Juergen Schoenwaelder Jacobs University Bremen gGmbH Phone: +49 421 200 3587 Campus Ring 1 | 28759 Bremen | Germany Fax: +49 421 200 3103 <http://www.jacobs-university.de/>
- [netmod] Potential additions to rfc6087bis: RegEx… Xufeng Liu
- Re: [netmod] Potential additions to rfc6087bis: R… Juergen Schoenwaelder
- Re: [netmod] Potential additions to rfc6087bis: R… Per Hedeland
- Re: [netmod] Potential additions to rfc6087bis: R… Ladislav Lhotka
- Re: [netmod] Potential additions to rfc6087bis: R… Per Hedeland
- Re: [netmod] Potential additions to rfc6087bis: R… Carsten Bormann
- Re: [netmod] Potential additions to rfc6087bis: R… Xufeng Liu
- Re: [netmod] Potential additions to rfc6087bis: R… Xufeng Liu
- Re: [netmod] Potential additions to rfc6087bis: R… Juergen Schoenwaelder
- Re: [netmod] Potential additions to rfc6087bis: R… Xufeng Liu
- Re: [netmod] Potential additions to rfc6087bis: R… Juergen Schoenwaelder
- Re: [netmod] Potential additions to rfc6087bis: R… Benoit Claise
- Re: [netmod] Potential additions to rfc6087bis: R… Juergen Schoenwaelder
- Re: [netmod] Potential additions to rfc6087bis: R… Robert Wilton
- Re: [netmod] Potential additions to rfc6087bis: R… Andy Bierman
- Re: [netmod] Potential additions to rfc6087bis: R… Robert Wilton
- Re: [netmod] Potential additions to rfc6087bis: R… Juergen Schoenwaelder
- Re: [netmod] Potential additions to rfc6087bis: R… Robert Wilton
- Re: [netmod] Potential additions to rfc6087bis: R… Juergen Schoenwaelder
- Re: [netmod] Potential additions to rfc6087bis: R… Andy Bierman
- Re: [netmod] Potential additions to rfc6087bis: R… Robert Wilton
- Re: [netmod] Potential additions to rfc6087bis: R… Kent Watsen
- Re: [netmod] Potential additions to rfc6087bis: R… Lou Berger
- Re: [netmod] Potential additions to rfc6087bis: R… Andy Bierman
- Re: [netmod] Potential additions to rfc6087bis: R… Robert Wilton
- Re: [netmod] Potential additions to rfc6087bis: R… Alex Campbell
- Re: [netmod] Potential additions to rfc6087bis: R… Robert Wilton
- Re: [netmod] Potential additions to rfc6087bis: R… Juergen Schoenwaelder
- Re: [netmod] Potential additions to rfc6087bis: R… Juergen Schoenwaelder
- Re: [netmod] Potential additions to rfc6087bis: R… Acee Lindem (acee)
- Re: [netmod] Potential additions to rfc6087bis: R… Juergen Schoenwaelder
- Re: [netmod] Potential additions to rfc6087bis: R… Andy Bierman
- Re: [netmod] Potential additions to rfc6087bis: R… Robert Wilton
- Re: [netmod] Potential additions to rfc6087bis: R… Carsten Bormann
- Re: [netmod] Potential additions to rfc6087bis: R… Robert Wilton
- Re: [netmod] Potential additions to rfc6087bis: R… Robert Wilton
- Re: [netmod] Potential additions to rfc6087bis: R… Ladislav Lhotka
- Re: [netmod] Potential additions to rfc6087bis: R… Andy Bierman
- Re: [netmod] Potential additions to rfc6087bis: R… Robert Wilton
- Re: [netmod] Potential additions to rfc6087bis: R… Robert Wilton
- Re: [netmod] Potential additions to rfc6087bis: R… Andy Bierman
- Re: [netmod] Potential additions to rfc6087bis: R… Ladislav Lhotka
- Re: [netmod] Potential additions to rfc6087bis: R… Robert Wilton
- Re: [netmod] Potential additions to rfc6087bis: R… Juergen Schoenwaelder
- Re: [netmod] Potential additions to rfc6087bis: R… Lou Berger
- Re: [netmod] Potential additions to rfc6087bis: R… Ladislav Lhotka
- Re: [netmod] Potential additions to rfc6087bis: R… Robert Wilton
- Re: [netmod] Potential additions to rfc6087bis: R… Ladislav Lhotka
- Re: [netmod] Potential additions to rfc6087bis: R… Robert Wilton
- Re: [netmod] Potential additions to rfc6087bis: R… Robert Wilton
- Re: [netmod] Potential additions to rfc6087bis: R… Lou Berger
- Re: [netmod] Potential additions to rfc6087bis: R… Andy Bierman
- Re: [netmod] Potential additions to rfc6087bis: R… Lou Berger