RegexError with negative lookahead pattern in IDS/ifctester
I'm using ifcopenshell and ifctester to perform automated validation on BIM models through IDS files. I've encountered a critical error during validation execution that prevents the system from working correctly.
During IDS validation execution, I'm getting the following error:
elementpath.regex.codepoints.RegexError: invalid '(?...)' extension notation at position 1: '^(?!(IFCBUILDING$|IFCROAD$|IFCSITE$|IFCPROJECT$|IFCTYPEPRODUCT$|IFCELEMENTCOMPONENT$| IFCDISTRIBUITIONELEMENT$|IFCDISTRIBUTIONSYSTEM$|IFCELEMENTASSEMBLY$|IFCFEATUREELEMENT$| IFCFURNISHINGELEMENT$|IFCBUILDINGSTOREY$|IFCOPENINGELEMENT$|IFCSYSTEM$|IFCGRID$|IFCGROUP$| IFCFACILITYPARTCOMMON$|IFCROADPART$|IFCALIGNMENTVERTICAL$|IFCALIGNMENTHORIZONTAL$| .*(?i:type)$)).*
Full stack trace shows:
File "...\ifctester\facet.py", line 1056, in __eq__ if re.compile(identities.translate_pattern(pattern)).fullmatch(other) is None: File "...\elementpath\regex\patterns.py", line 172, in translate_pattern raise RegexError(msg.format(pos, pattern))
The regex pattern used in my IDS file contains a negative lookahead (?!...) to exclude specific IFC classes from validation. The pattern is structured like this:
^(?!(IFCBUILDING$|IFCROAD$|IFCSITE$|...)).*
The logic is: "select all IFC entities except those in the exclusion list".
Why this approach? In the context of my IDS specification, it's much more practical and efficient to define a negative list (what to exclude) rather than a positive list (what to include), because:
- IFC classes to exclude are about 15-20
- IFC classes to include would be 100+
Has anyone encountered this problem? Is there a best practice for handling IFC class exclusions in IDS files while maintaining compatibility with ifctester?
I add that I used this same ids in Solibri and it works correctly
