In an AMPscript If statement, is there a way to use "contains" as the operator? For example:
If Var1 Contains "Dog" Then do this
Would I just have to use a regular Expression?
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.Sign up to join this community
You can use IndexOf() function to do that.
%%[ Var @str, @var, @msg /* Set the value to check */ Set @var = "Dog" /* Set the string to check */ Set @str = "MyDogIsMyFriend" /* Does it match */ if IndexOf(@str,@var) > 0 then Set @msg = "We Found It" else Set @msg = "We didn't find it" endif ]%% %%=v(@msg)=%%
I've been looking for the same solution and I found the answer to the similar question on 3sixty.