How to check for special characters in a csv file ?

I'm trying to validate a csv file, what I'm trying is to Raise an exception if the file contents have special characters inside it
Please help

Can you be more specific on what special characters?

Either way, you should use regex expressions for this. 

I use https://regex101.com/ to create and test the regular expression before i implement it.

these are the special characters

[!@#$%^&*(),.?"":{}|<>]

I see , and " in your list of special characters. But these are common delimiters in CSV.

Does this mean you can already read the csv into a text variable and split it into a list of a structure, and now you want to check each attribute for these characters?


if not, i would recommend to split your check into a regular expression without the , and ". those characters are always off limit.


To check for , and " you need a check specific to the input you expect: number of fields (delimited by a ,) and if there is no " inside that field or if there are 2 (at the beginning or end).


You need to be a bit more specific if you want a more specific solution to your problem.

I will keep my case simple

I have to upload a file, before uploading I've to check if my file contains above special characters

If I've special characters I've to abort upload


The regular expression is: 

[!@#$%^&*(),.?"":{}|<>\[\]]


If it finds anything, its not good. If not: the csv is correct.


But i still must say you cant check on , or ", since that is something you will definitely find in a csv.

No problems.

Please mark it as solution to help those other Outsystems fans when they have a similar problem ;)

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.