[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [xacml] regex in the spec
Bill Parducci wrote: > i was looking at the regular expressions during the f2f and wanted to > toss out some thoughts on it after looking into it a bit more. > > first, in the spec we don't really say much in terms of regular > expression conformance and that kinda worries me. i am thinking that > maybe we should call out a generally accepted flavor of regex, then pare > it down as (if) necessary for our spec. Are you talking about the regexp function? We pretty clearly cite XQuery there, which in turn (in my opinion) is pretty clear. At least, I've been able to implement that without too much pain. I do think there's some value in having more regexp cases in the conformance test, if that helps. Are there other uses of regexp that you're worried about? > second, i was looking at the expressions themselves and am a little > confused--because, i think, the current verbage uses *perl* regex and i > was thinking that we would be using *posix* regex, specifically 'POSIX > 1003.2' flavored expressions--by this: > > <xs:pattern value="(\d+\.)*\d+"/> Ah, you're talking specifically about the new version number string. Since I added this string, I guess I can comment on it :) In this case, I'm not using Perl or POSIX, but the format specifically defined in XMLSchema. There is no ambiguity about what form this is in. Patterns in XMLSchema must use the XMLSchema regular expression format. > i assume that we want to cover this: > > 1 > 1.1 > 1.2.3 > 1123.2386576.93783636.736235252 > ... Yup. > using posix regex i would write this as: > > <xs:pattern value= "[0-9]+(\.([0-9])+)*" /> > > besides the syntactical difference i would move the literal '.' to the > predicate so that '1.' isn't valid ;o) Actually, "1." is not valid by the current expression, since the pattern says that a version string must end in a digit. As for the specifics of the pattern, I don't care too much about how we form it. I used the current string because it's the most common way to phrase something like this in XMLSchema, therefore I believe it will be the most accessible. > as to "Simple type VersionMatchType": > > <xs:pattern value="((\d+|\*)\.)*(\d+|\*|\+)"/> > > if the idea here is to simply include a direct regular expressions i > suggest using the same: > > <xs:pattern value= "[0-9]+(\.([0-9])+)*" /> The idea here is _not_ just to provide a direct match. You should look at the text I added to go with this that explains exactly what this pattern is used for. This is a very simple wildcard that only lets you form a few patterns. Here we wouldn't want to use a full-featured regexp language, since we only want people to say one of a few things: 1.2.4 1.+ 1.*.4 1.2.* which all match the string "1.2.4.". I know of no existing language we could reference that only provides these limited options. Since no one commented when I made the original suggestion, I assumed that people approved. Do you have something in mind that you think would be more appropriate here? > going this route ensures that just about any language that operates on > regular expressions will support the syntax and that there is a tangible > reference point for the semantics. Going which route? I don't really understand what you're proposing we change. The pattern strings are written in XMLSchema, and they express very specific, very (intentionally) limited meaning that I provided clear text to explain. seth
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]