Intelligence - Data Validation doesn't honor regex expressions

Hi there,

Quick follow up on my last post regarding the data validation tool ( Questions regarding Speckle Intelligence & Validation - Speckle Help - Speckle Community):

Regex matching doesn’t seem to work for some reason. I’m using valid regex syntax (copied & modified from the Speckle Docs page), but all of my elements fail the check even though they shouldn’t:

Edit / Addendum: is there a release date for editing validation rulesets? We’re currently starting a large-ish project and would love to test some more complex checking rules :slight_smile:

Good catch, and your regex is fine(ish) — /^(GED|FBO)/ is the same shape as the docs example (/^(Wall|Door)/, described as “matches values starting with Wall or Door”).

But, is this a bug?
What’s actually happening: regex mode evaluates the pattern as a full-string match, not a search/prefix match. ^(GED|FBO)only matches a value that is exactly “GED” or “FBO” and nothing else — it doesn’t reach “GED_I_TR_STB_0200_Bestand,” because nothing after the anchored portion is accounted for. That’s why all 46 elements failed even though a chunk of them do start with GED. GED* in wildcard mode, or /^(GED|FBO).*/ in regex mode, both work, since either consumes the rest of the string too.

I’ll get the docs corrected — the /^(Wall|Door)/ example doesn’t actually produce the result it describes, and we should state plainly that a pattern needs to account for the whole value, not just the part you’re asserting.

Perhaps you can help with an opinion?
One thing I’m genuinely unsure of: is full-string matching what you’d expect from “Matches pattern,” or would search/prefix matching (not needing to account for the rest of the string) be more useful for how you write these rules? Your answer will help us decide whether to just document the current behaviour or reconsider it.

No date I can share yet on editable rulesets other than after August 31st — I’ll make sure the interest is flagged given you’re about to lean on this for a larger project.

1 Like

Thanks @jonathon for making that clear. Adding the .* to the end of the regex does indeed work.

I think the current setup - given that the docs reflect that - is actually sufficiently flexible. “Matches pattern” to me indicates a full-string match, but throwing regex into the mix implicated to me that wildcards and prefix matching are also possible (which they are, as I know now).

Our primary use case right now is to make sure that all elements match our naming conventions. We had a lengthy discussion about this just last week, because when checking for parameter value consistency, we have to be able to identify elements in a way that we’re 99% sure “what” they are. This is not easy for Revit elements, because apart from the element category, nothing is really hardcoded in Revit - for elements of category “Walls” you can be confident they’re some sort of wall, but not if they’re load-bearing, interior/exterior facing, what material they’re made of, what assembly code they should have etc. because those properties all have to be entered by hand and are therefore error prone.
And it gets even more complicated for everything that is not a system family - everything apart from walls, floors and roofs, basically - because for loadable families, you can even change the family category manually. So technically, you could have a structural column mis-labeled as a furniture element, and you would have no indication whatsoever of what you’re dealing with.

After a lot of discussion, we finally settled on one universal rule: Every element family (for loadable families) or family type (for system families) has to be named according to our naming conventions. If we assume that every element is named correctly, we can identify it and construct our parameter checks from there. For instance, a wall named WAN_I_NTR_GIK_0150_Einfachständerwand would be a Wall (WAN), interior (I), non-load bearing (NTR), made of gypsum plaster board (GIK) with a thickness of 150 mm.The free text at the end gives additional information about the characteristics of the element.

From here, we could - for instance - check that the cost group parameter is set to 342, which is the correct cost group for non-load bearing interior walls according to german DIN 276 specification, or that the element is located on the appropriate workset.

But because this all hinges on element naming, making sure the naming is correct is absolutely crucial.

Here is an example of our naming convention for floors:

Thanks for noting my interest in ruleset editing - I’m excited for what’s to come.

We are working on the “what happens next” after a data validation identifies gaps… let me know if you want to be involved.

1 Like

@jonathon awesome, I’d be happy to be involved and share my insights if you’re interested.