Now I fooled myself entirely. When writing new rules I always check after each line the result. But a debug info that unnecassarily creates trouble happened to me the first time
Thanks also for you explanation Rich.
The above code is still not working. Just to provide the correct code here, in case somebody else falls into this trap:
You may not declare the lambda variable as a String variable
var strNames = strFileNames.split('\n').map[e | e.split(".jpg").get(0)]