I need to create a custom footer that will dynamically be populated, If the subscriber key is a Salesforce ID (starts with 003(contact), 005(user) or 00q(lead), 001(account) AND it will always be 18 digits, does not contain @ symbol, then we need to display the custom preference center URL 1. If the subscriber key is not a Salesforce ID, i.e. it has an email address then the Custom Preference Center URL 2 must be displayed.
Solution Which I'm thinking:-
Created 2 HTML content that will have a code of Footer, where I'll mention the URL of Profile Centers.
Use those HTML content in Dynamic Content Block-based and apply rules on D.E chosen to show which HTML content needs to be displayed. If the Subscriber key contains 003 or 005 it should display HTML content that has preference Center URL 1. If the Subscriber Key contains @ or .com it should display HTML Content that has a preference center 2 URL.
I have a question can a subscriber Key column hold Salesforce ID and Email Address as a value ?? which we will use to create a rule in the dynamic content block?
Someone else has some other alternative solution to this requirement??
Modified Code:
%%[
SET @SFIDregEx = "^00[135Q][a-zA-Z0-9]"
SET @EmailRegEx = "^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,})$"
SET @subKey = AttributeValue("_subscriberkey")
SET @Email = AttributeValue("emailaddr")
SET @match1 = RegExMatch(@subKey, @SFIDregEx1, 0)
SET @match2 = RegExMatch(@Email, @EmailRegEx, 0)
SET @len1 = length(@match1)
SET @len2 = length(@match2)
IF @len1 > 0 THEN
SET @redirect = "https://google.com" -----// example
ENDIF
IF @len2 >0 THEN
SET @redirect = "https://trailhead.com" -----//example
ELSE
SET @redirect = "https://yahoo.com" ------//example
ENDIF
]%%