Skip to content

Docs: state that IDS regex patterns match the whole value - #449

Open
BIMvoice wants to merge 1 commit into
buildingSMART:developmentfrom
BIMvoice:docs/xsd-regex-whole-value
Open

Docs: state that IDS regex patterns match the whole value#449
BIMvoice wants to merge 1 commit into
buildingSMART:developmentfrom
BIMvoice:docs/xsd-regex-whole-value

Conversation

@BIMvoice

@BIMvoice BIMvoice commented Aug 3, 2026

Copy link
Copy Markdown

The Restrictions page links regex101.com as a learning resource. Regex101 does not implement the XML Schema Regex flavour that IDS uses, and one difference in particular does not produce an error, it silently returns the opposite answer.

The page's own example contradicts the tool it links

The existing table says DT[0-9] rejects "DT123". That is correct, and it is correct because IDS patterns must match the whole value. Tested with xmlschema, the library IfcTester uses to evaluate IDS patterns:

Pattern Value IDS (XML Schema) regex101 style search
DT[0-9] DT123 fails (as the docs say) match
.{0,10} WALL-EXTERNAL fails match
.{0,10} DOOR-01-A2 passes match

So a reader who checks the documentation's own example in the tool the documentation recommends is told the opposite of what the documentation says. For a length constraint like .{0,10} the effect is worse, because the pattern appears to accept values that IDS will reject, and nothing signals that anything is wrong.

What this PR changes

The page already notes that flavours differ and points to XML Regular Expressions as authoritative, which is good. This adds the one specific difference that fails silently:

  • states plainly that IDS patterns match the whole value, and points out that the existing table already depends on this
  • explains how to reproduce IDS behaviour in a general purpose tester by wrapping the pattern in ^ and $
  • warns not to copy those anchors back into the IDS pattern, since ^ and $ are not part of XML Schema Regex

It also mentions two free online testers that implement XML Schema Regex directly, so the anchoring is handled automatically.

On the two tools, so maintainers can judge

They are third party and not affiliated with buildingSMART, and the text says so.

  • DevToys XSD Regex Tester — I checked its stated behaviour: it uses the xspattern library and documents that XSD patterns match the entire string by default. I have not independently audited its output.
  • Xsd Pattern Tester — free and online, but it is a client side app and I could not verify its behaviour or find its source, so it is offered as an option rather than a recommendation.

If linking third party tools is not appropriate here, the anchoring explanation stands on its own and I am happy to drop the tool paragraph entirely. That is the part that matters; the tools are a convenience.

Happy to reword any of this to fit the manual's voice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant