It identifies the exclamation mark !
as an operator prefix and not as part of the function name.
In your list: <$list filter="... [.mentions[this]!.mentions[that]]" ... />
the second function name is the same as the first one – and the internal structure knows about the !
prefix.
The filter evaluation seems to know and respect the internal !
prefix with functions used as operators.
Conclusion
It will also work with the following code.
Your second function definition is ignored. (Which actually confused my quite a bit)
\function .mentions(re) [search:title:regexp<re>]
<$list filter="... [.mentions[this]!.mentions[that]]" ... />
All possible test-cases
\function .mentions(re) [search:title:regexp<re>]
----
test `.mentions`
1: link: <$list filter="[[input-this].mentions[this]]"/>
2: no link <$list filter="[[input-that].mentions[this]]"/>
3: no link: <$list filter="[[input-this].mentions[that]]"/>
4: link <$list filter="[[input-that].mentions[that]]"/>
----
test `!.mentions`
1: no link: <$list filter="[[input-this]!.mentions[this]]"/>
2: link <$list filter="[[input-that]!.mentions[this]]"/>
3: link: <$list filter="[[input-this]!.mentions[that]]"/>
4: no link <$list filter="[[input-that]!.mentions[that]]"/>
-----------
test `.mentions[a]!.mentions[b]`
1: link <$list filter="[[input-this].mentions[this]!.mentions[that]]"/>
2: no link <$list filter="[[input-that].mentions[this]!.mentions[that]]"/>
3: no link <$list filter="[[input-this].mentions[that]!.mentions[that]]"/>
4: no link <$list filter="[[input-that].mentions[that]!.mentions[that]]"/>
5: no link <$list filter="[[input-this].mentions[this]!.mentions[this]]"/>
6: no link <$list filter="[[input-that].mentions[this]!.mentions[this]]"/>
7: no link <$list filter="[[input-this].mentions[that]!.mentions[this]]"/>
8: link <$list filter="[[input-that].mentions[that]!.mentions[this]]"/>
---
---
test with title: `this-that` and `this-thaX`
1: no link <$list filter="[[input-this-that].mentions[this]!.mentions[that]]"/>
2: link <$list filter="[[input-this-thaX].mentions[this]!.mentions[that]]"/>
Link to the responsible parser code in TW
hope that helps
-mario