After you
send -- "grep -il $DUL *\r"
Expect sees all this output
ranosusr@rn2osscs603> grep -il FXLP89 *
FXLP89_FRTALZ_SIU_ARNE.xml
ranosusr@rn2osscs603>
The part that is matched by the regular expression "$DUL.*.xml" is in bold:
ranosusr@rn2osscs603> grep -il FXLP89 *
FXLP89_FRTALZ_SIU_ARNE.xml
ranosusr@rn2osscs603>
You should expect this:
set prompt {ranosusr@rn2osscs603> }
expect -re "($DUL\\S+\\.xml).*$prompt$"
set filename $expect_out(1,string)
Here, we're expecting the pattern: the value of $DUL followed by some non-whitespace chars followed by a literal dot and "xml" (capture all of that) followed by some chars and the prompt and the end of string. The backslashes are doubled because we're using a double quoted string, and the backslashes have to be passed literally to the regex engine.