I see, I didn't explain my problem in a clear way. The problem of your code is that the tag must come inside the range of RADIUS (you set it at 25) to be detected. That is fine, but not the goal of my implementation. What I need is to print out the concordance PLUS the last tag seen before finding that concordance (i.e. before matching the $query).
I'd like to put this information in a table "concordance of $query PLUS last tag seen before encountering $query".
That is why I was trying to change the module's code.