[IFCOpenShell] IDS file to analyze has a property with a value other than XXX
I'm trying to develop an IDS file and analyze it through a python program to check if there is a certain property and if it has a value different from a predefined value. The best way I found for this was to evaluate whether the property exists with a value in the regex pattern '(?!Nenhum).+', which would be any value other than 'Nenhum'
The property of my IDS file that analize that:
<ids:property dataType="IFCTEXT" cardinality="required"> <ids:propertySet> <ids:simpleValue>Circuito</ids:simpleValue> </ids:propertySet> <ids:baseName> <ids:simpleValue>Circuito_*</ids:simpleValue> </ids:baseName> <ids:value> <xs:restriction base="xs:string"> <xs:pattern value="(?!Nenhum).+" /> </xs:restriction> </ids:value> </ids:property>
When i use the function validate with this IDS it gives an error "RegexError: invalid '(?...)' extension notation at position 0: '(?!Nenhum).+' "
What are the best practices for this situation?
Comments
I don't understand completely but maybe this https://github.com/buildingSMART/IDS/blob/development/Documentation/restrictions.md can be useful
Yes, thanks, that explains a few things, my case would be a complex restrictions with pattern and because of limitations of the XML Regular expressions for IDS its not possible use negative lookahead. So apparently it is really not possible with IDS to check if a property is not a predefined value.
Maybe try this

any number of characters (including zero characters) can occur before or after the text "Nenhum".
My solution that worked:
Negative lookahead its realy not possible for regular expressions in IDS, the negative, that specify that should not have something with some text, should be in the applicability as a ' maxOccurs="0" ', the requirements go empty. That is working for me to verify if a IFC file have a property with a error value and this allows the system to notify the designer to review these elements
The final IDS file specification look like this:
`
`
Indeed this is known as a prohibited specification.
There's an allowed alternative to this case?