Converting SRX to SDL SegmentationRules via Translation Memory API

I've written a C# console app using the Trados Studio (2015) SDK. The purpose is to read in a Segmentation Rules eXchange file and add the rules in it to a LanguageResources file. I am able to add the rules, but when I try to use the resulting LanguageResource with projects in Trados Studio, the new rules don't seem to work. At least part of the problem is that potential "trigger characters" that appear at the end of my PrecedingContext object (e.g., .?!) are escaped in the LR file.

So if the input regex was, for example,

[.?!]\p{P}?

then what I see when I view the rule in Studio is

[.?!]\p{P}\?+

which is not at all the same thing. Is there a way to disable this behavior?

***********

EDIT: This only seems to happen if I edit the rules in Studio, and switch between Basic and Advanced views. The API docs say "if you create a regex that cannot be parsed, Basic View will be disabled". This is the case for most of my SRX rules. My question is, what is doing the parsing here? And are the rules still evaluated/applied in this case?

Parents Reply Children