I got STEP file (can be read as text) which is written in EXPRESS.
The file looks like:
#14(REPRESENTATION_RELATIONSHIP($,$,#293,#291)REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#12)SHAPE_REPRESENTATION_RELATIONSHIP());
#35=MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION('',#180,888.125521);
#25=ADVANCED_BREP_SHAPE_REPRESENTATION('',(#29),#277);
#186=AXIS2_PLACEMENT_3D('',#270,#230,#231);
I would like to use Regular Expressions to get something like:
Match: REPRESENTATION_RELATIONSHIP($,$,#293,#291); Group1: REPRESENTATION_RELATIONSHIP; Group2: $,$,#293,#291
Match: ADVANCED_BREP_SHAPE_REPRESENTATION('',(#29),#277); Group1: ADVANCED_BREP_SHAPE_REPRESENTATION; Group2: '',(#29),#277
I am new to Regex and came up with this pattern:
(\b[A-Z\d]*[_[A-Z\d]*]*)(\((.*?)\))
which works a little, but for example will just match: ADVANCED_BREP_SHAPE_REPRESENTATION('',(#29)
instead of ADVANCED_BREP_SHAPE_REPRESENTATION('',(#29),#277)
Thank you for any help.
You might use
#\d+[(=](\w+)\((.*?)\)[;A-Z]
Explanation
#\d+[(=]
Match #, 1+digits and either (
or =
(\w+)
Capture group 1, match 1+ word chars\(
match (
(.*?)
Capture group 2, match any char as least as possible\)[;A-Z]
Match )
followed by either ;
or a char A-Z