type.inbound
and recipients.to[0].email.local_part is not null
and recipients.to[0].email.local_part != ""
and any(attachments,
strings.count(.file_name, '_') == 2
and strings.icontains(.file_name,
strings.concat('_',
recipients.to[0].email.local_part,
'_'
)
)
and regex.match(.file_name, '202\d{5}_[^\_]+_[A-Z0-9]+\..*')
)
Playground
Test against your own EMLs or sample data.