@Matches for validating Special Characters

Hello,

I am trying to validate a field value such that it does not contain some special charactes like &, <, >, ', "

I am using the following Input Validation formula…but its not working as I expected.

@If(@ThisValue=“”;@Failure(“Please enter a Description.”); @Matches(@ThisValue; “+{ & < > " '}”); @Failure(“Description cannot contain special characters.”);@Success)

I tried in several ways…but couldn’t get it to work. I tried removing the spaces between those special characters too…

Any help is greatly appreciated.

Thanks.

Subject: @Matches for validating Special Characters

try using @Contains as opposed to @Matches (which checks for patterns)

Subject: RE: @Matches for validating Special Characters

Thanks for responding back. I actually started working on changing the formula to use @Contains too…as I was not getting expected results thru @Matches. I am using the following formula:

@If(@ThisValue=“”;@Failure(“Please enter a description.”); @Contains(@ThisValue; “&” : “<” : “>” : “'” : " " "); @Failure(“Description cannot contain special characters.”); @Success)

It works for all mentioned characters except for "

Do I need to make any change in the formula wrt "

Thanks for your help.

Subject: RE: @Matches for validating Special Characters

yes, take the spaces out, use “"” don’t use " " "

Subject: RE: @Matches for validating Special Characters

It worked…I wonder how I missed that :slight_smile:

Thanks so much.