In Gmail, all phone numbers get blue linked automatically. I used to manually take away the styles via HTML, but it has become tedious. I recently found out about how Regular Expressions can match the format of a string. So I am wondering if I can write a pattern that matches a phone number format. If it does match, I would like to apply a style to remove the blue link.
Not sure if this is how Regular Expressions even work, but I figured that I would give it a try.
So basically, I would like to find all phone numbers in the email body and apply styles to them if they match the pattern of the Regular Expression.
So far, I have this:
%%[
var @s, @o, @p
set @s = "uajakd0123456789dashdga"
set @p = "1?[\s-]?\(?(\d{3})\)?[\s-]?\d{3}[\s-]?\d{4}"
set @o = RegExMatch(@s, @p, 1)
outputLine(concat("input: ",@s,"<br>"))
outputLine(concat('pattern: "',@p,'"<br>'))
outputLine(concat("output: ",@o,"<br>"))
]%%
I keep getting an output of only the first three numbers in a phone number of any format when this RegEx renders.
When I do this on RegExr.com, it works. But when I do it in Salesforce Marketing Cloud, it does not work. Does anybody have any idea why?