I am confused with your entries. First, lets clear up the code issue. I initially made an error in the code. And then I messed up again. The code you need to be using is:
Contains( files[i], "123" ) > 0 & Contains( files[i], "XY" ) > 0 & Contains( files[i], "XY" ) > Contains( files[i], "123" )
There is nothing magical about this code. Let me explain it. The Contains() function looks across a literal string, in your case, the current value of Files[i], looking for the value of the second argument "123". If found it returns the position it was found in. So the first use of the Contains() makes sure that there is the value "123". The second use makes sure there is a value of "XY" and the thrid comparison makes sure that "XY" is found after the value of "123". That is all it is doing.
I apologize for the coding error.....
Jim