It seems that there are much easier ways of going about this depending on what you are trying to accomplish. But here is one way you could feasibly do it with expressions.
Assuming you have a data file with the image names on each line and assuming your text layer reading the data file is the first layer of each comp, you would have to put every single image into each composition with this Opacity expression:
(thisComp.layer(1).text.sourceText == thisLayer.name) ? 100 : 0
This expression sets opacity to 100 if the name matches or sets it to 0 if it doesn’t. This is only helpful if you’re trying to match a lot of images with specific text in separate compositions. Otherwise it’d probably be better to just import the images into separate compositions using built-in tools and scripts.
If you import the images using “New Composition from Selection” then choose multiple compositions, you could use the names of the images as your comp names in your data file to match the text.
Dan Fredley