Easy one...How to determine if a filename contains a list of characters

Sometimes I think I am going crazy…

I am getting mail attachments and trying to see if they contain any special characters in the filename. Special characters are “@” or “!” or “$” or any other that I want to add to this list to check if they exist.

Do I first create a variable with all of the items in the list? If so, how?
Then, do I create an if statement to check to see if filename contains the variable?


can I check the list of values in the list in the IF statement. If so, how to do?

1 Like

Hi @tsweat,

(?<=Attachments Name:\s)[A-Z](!@#$ä%^&(),.?":{}|<>)`
Here all the parameters like @#$ä%^&*(), has to be enclosed within parantheses.
For testing either regex101.com or regexr.com or regextester can be used that describes what we do.

Diego Turati


Once you receive email, then you will check if mail message contains attachment, if yes then just create one folder with current date and time which will be unique all the time, then you can use directory.getfiles you will be having file names as array of strings then you can use simple if then item.tostring.contains
Else you can also use regex expression as mentioned above…