Created
December 11, 2015 17:29
-
-
Save wvpv/7fd5076dd983796e77cf to your computer and use it in GitHub Desktop.
SFMC AMScript Regex Match
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%[ | |
var @str1, @str1b, @str2, @str2b, @str3, @str3b, @str4, @str4b | |
set @str1 = "whee 1/2 whoop" | |
set @str1b = replace(@str1,regexmatch(@str1, "\s\w/\w\s" , 0 , "IgnoreCase"), " ") | |
set @str2 = "whee *derp* whoop" | |
set @str2b = replace(@str2,regexmatch(@str2, "\*\w+\*" , 0 , "IgnoreCase"), "") | |
set @str3 = "whee (whatev) whoop" | |
set @str3b = replace(@str3,regexmatch(@str3, "\s\(.+\)\s" , 0 , "IgnoreCase"), " ") | |
set @str4 = "whee/whoop" | |
set @str4b = replace(@str4,"/"," / ") | |
]%% | |
Orig: %%=v(@str1)=%%<br/> | |
Fixed: %%=v(@str1b)=%%<br/> | |
Orig: %%=v(@str2)=%%<br/> | |
Fixed: %%=v(@str2b)=%%<br/> | |
Orig: %%=v(@str3)=%%<br/> | |
Fixed: %%=v(@str3b)=%%<br/> | |
Orig: %%=v(@str4)=%%<br/> | |
Fixed: %%=v(@str4b)=%%<br/> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment