Weird thing I found while playing around with this.
I typed sample text, XXXX then from the menu type –> insert –> text variable –> filename. Resulting in XXXXUntitled-2.
I tried your non-working lookahead and it didn't work for me either.
Then I threw a single letter, v, in front of the XXXX.. Then I tried looking for (.)(?=.+~l)
…meaning, I added [any character, one or more times] into the lookahead. That actually worked, it highlighted the v in the text string vXXXXUntitled-2
Here's where it gets weird. If I insert yet another character, for example vvXXXXUntitled-2, it doesn't find it UNLESS the cursor happens to be exactly five characters to the left of “Untitled-2”. This is regardless of whether I search document, story, selection, etc. So if the cursor is at the very beginning of vvXXXXUntitled-2, no match. Move it over to the right once… match. Move it over to the right again… no match.
It seems this is the behavior regardless of how many characters I put in front of the filename. There's some significance to it about being exactly 5 characters in front of the filename variable.
Unfortunately this does seem to indicate a bug, and without a real practical workaround.