There are many slight variations among regex application settings and syntax in different programming languages. Syntax is mostly identical but YMMV.
Good references include * https://www.regular-expressions.info * https://www.regex101.com * more references listed at https://www.web3d.org/specifications/X3dRegularExpressions.html#References all the best, Don -- Don Brutzman Naval Postgraduate School, Code USW/Br [email protected] Watkins 270, MOVES Institute, Monterey CA 93943-5000 USA +1.831.656.2149 X3D graphics, virtual worlds, Navy robotics https:// faculty.nps.edu/brutzman From: Roger L Costello <[email protected]> Sent: Wednesday, April 6, 2022 10:34 AM To: [email protected] Subject: Bug in Daffodil NPS WARNING: *external sender* verify before acting. With this input: GENTEXT/FOO/TAS// The following DFDL generates the dreaded "Left over data" error: <xs:element name="GeneralTextInfo" minOccurs="0" dfdl:initiator="GENTEXT" dfdl:terminator="//"> <xs:complexType> <xs:sequence dfdl:separator="/" dfdl:separatorPosition="prefix"> <xs:element name="TextIndicator" minOccurs="0" nillable="true" type="non-zero-length-string" dfdl:lengthPattern="[A-Z ]+"/> <xs:element name="FreeText" minOccurs="0" nillable="true" type="non-zero-length-string" dfdl:lengthPattern="[A-Z]|([A-Z][/A-Z]*[A-Z])"/> </xs:sequence> </xs:complexType> </xs:element> If I reverse the regex for FreeText: <xs:element name="GeneralTextInfo" minOccurs="0" dfdl:initiator="GENTEXT" dfdl:terminator="//"> <xs:complexType> <xs:sequence dfdl:separator="/" dfdl:separatorPosition="prefix"> <xs:element name="TextIndicator" minOccurs="0" nillable="true" type="non-zero-length-string" dfdl:lengthPattern="[A-Z ]+"/> <xs:element name="FreeText" minOccurs="0" nillable="true" type="non-zero-length-string" dfdl:lengthPattern="([A-Z][/A-Z]*[A-Z])|[A-Z]"/> </xs:sequence> </xs:complexType> </xs:element> Then the error goes away. This seems like a bug in Daffodil. The order in which a regex OR clause is expressed should not matter. /Roger
smime.p7s
Description: S/MIME cryptographic signature
