Take this short XML snippet for defining strings in gtksourceview:
<context id="string" style-ref="string" end-at-line-end="true">
<start>"</start>
<end>"</end>
<include>
<context id="special-string" style-ref="special">
<match>(foo|bar)</match>
</context>
<context ref="def:line-continue"/>
</include>
</context>
This highlights any instances of "foo" or "bar" inside a string. Suppose I want to highlight these two when they are the entire string, so that "foo" has the middle three characters highlighted but "foobar" is not highlighted at all. Is this possible in gtksourceview?
I tried using anchors ^...$
and lookahead/lookbehind (?<=")
/ (?=")
but the former didn't work and the latter broke the syntax highlighter entirely.