My rule looks like this
<ExtensionPoint xsi:type="DetectedEntity">
<Label resid="contextLabel" />
<SourceLocation resid="testResId" />
<Rule xsi:type="RuleCollection" Mode="And">
<Rule xsi:type="RuleCollection" Mode="Or">
<Rule xsi:type="ItemIs" ItemType="Message" />
<Rule xsi:type="ItemIs" ItemType="Appointment" />
</Rule>
<Rule xsi:type="ItemHasRegularExpressionMatch" RegExName="Test" RegExValue="\+1" PropertyName="BodyAsPlaintext" Highlight="All"/>
</Rule>
</ExtensionPoint>
as you can see the regex is looking for a +1
to highlight (my real regex does more than that, but this example is enough to reproduce the issue)
It seems like the search works, since it returns the results, but i see errors in the dev console and highlight is not happening. My guess is Outlook is using the actual matches to highlight and put them into a new regex (which in fact cannot start with a plus sign). The exception is:
constants.ts:1 Uncaught (in promise) SyntaxError: Invalid regular expression: /+1/: Nothing to repeat
at new RegExp (<anonymous>)
at constants.ts:1
at Array.forEach (<anonymous>)
at markElements.ts:54
at AAQkADAzYTZlYTYyLWQyMGMtNDFhOS05MTAzLTQyYjJhNjBhMTYwZgAQAINoPf%2BPCdhNj6AVUpiXz4w%3D:347
at Object.next (AAQkADAzYTZlYTYyLWQyMGMtNDFhOS05MTAzLTQyYjJhNjBhMTYwZgAQAINoPf%2BPCdhNj6AVUpiXz4w%3D:347)
at a (AAQkADAzYTZlYTYyLWQyMGMtNDFhOS05MTAzLTQyYjJhNjBhMTYwZgAQAINoPf%2BPCdhNj6AVUpiXz4w%3D:347)
I did not find any documentation on the office addin development sites if/how should i escape these. Any idea?
IMHO this seems to be a bug in the Outlook reading pane. It seems to be passing the content found by the regex in the manifest to the other regex that is responsible for highlighting the matches in the reading pane (using markjs) as the regex pattern. This is what I see in the markElements.ts
file, and keyword
is the actual string found in the email body: