.NET Framework Bookmark and Share   
 index > Regular Expressions > Microsoft "official" regex for string version of hierarchyid
 

Microsoft "official" regex for string version of hierarchyid

Is there an "official" Microsoft approved regex for the string format of the SqlType hierarchyid for SQL Server 2008?
solomon
there should be no official ms regex for this. Have you looked up the regex in http://regexlib.com/?


(rest of form content)
ImDbg
All a hiercharchy really has is a series of of slashes /.....data.../ etc

Were you looking for something specific?

John Grove - TFD Group, Senior Software Engineer, EI Division, http://www.tfdg.com
JohnGrove
@ImDbg: I disagree. Microsoft distributes SqlTypes.xsd from 2004 which contains what I'll call "official Microsoft" regexes for all of the other SqlServer datatypes, and I do not see any reason why they should fail to provide additional "official" regexes for the newer SqlServer datatypes including hierarchyid. Microsoft are you listening?

@JohnGrove: It would be nice to have an "approved" regex fully compatible with the hierarchyid datatype so that it's possible to go the full round trip from a SqlHierarchyid.ToString, perhaps manipulate and/or create a new id in string format, and then parse(theString) back to the hierarchyid in binary format. In this setting, it would be great to have the proper regex to test the string before parsing it back to the binary format.

Sure the regex should match a series of /{field}/{field}/.... where each {field} is {integer.integer.integer....} but under what additional constraints? As long as Microsoft is the organization responsible for declaring and defining the underlying datatype, they will have to be the ones to define an official regex.

Meanwhile, we can work with our own unofficial regexes. However, I just thought that it would be useful to ask if Microsoft had done an official one or not. And if they have not, then they should!!!
solomon

Since it is so elementary, why would there have to be?


John Grove - TFD Group, Senior Software Engineer, EI Division, http://www.tfdg.com
JohnGrove
My goodness. Does there always have to be some kind of veiled insult in these forums when asking a question or making a request?!?

No, it's not so elementary.

Microsoft controls the underlying datatype including thesize of the hierarchyid in binary format and therefore the API for the datatype. And sothe sizeof thebinary formatis anotherdeterminant ofwhether or not a string can be parsed successfully.

Again, it's a simple and reasonable request for me to make of Microsoft.

And/or anybody who thinks that it is such a trivial matter to do, then pleaseprove your expertise by providing the regex and/or parsing routine that guarantees compatibility of an input stringwith the underlying hierarchyid.
solomon

Well I was going to offer one, but, I'll let you have at it since you think I was insulting you.


John Grove - TFD Group, Senior Software Engineer, EI Division, http://www.tfdg.com
JohnGrove

You can use google to search for other answers

Custom Search

More Threads

• Reqular Expression for Alphanumeric
• URL Validation help
• Fuzzy logic using RegEx...
• Regular Expression Help Needed Pls
• Help me in creating appropriate RegEx
• Unexplained new line or break
• rule for "url ends with dot" in url rewriting ?
• Is the group always the 2nd group?
• How to find the last occurence of <p> within a textblock tiltled <h2>??
• Regex.Replace object reference error