1

I'm trying to search HTML content in Content Builder using regular expressions. I want to find all MailChimp personalization strings that match *|string|*.

I'm using the expression [|*]+[a-zA-Z]+[|*]+ which works in Sublime, but I can't figure out how to get this to work in Content Builder's search interface.

I note that if I open the search dialog, there are the instructions:

(Use /re/ syntax for regexp search)

Can someone explain what this actually refers to?

Content Builder search

1

I just tried the expression and you need to escape the star and the pipe. For the HTML-Snipped you posted in your screenshot I entered the following in the search bar:

/\*\|[a-zA-Z]+\|\*/

The expressions seem to work like regular expressions in javascript for example. To try out such expressions (with explanation of the possible tokens, etc.) I find regex101.com very helpful.

0

The documentation states that the standard syntax for regular expressions should be the same as the one used in Java, if you want to search for substrings in between pipes in your html you can use the following syntax:

(?<=\|)[^|]+(?=\|)

you can use https://www.freeformatter.com/java-regex-tester.html to validate

In Apex, Patterns and Matchers, as well as regular expressions, are based on their counterparts in Java. See http://java.sun.com/j2se/1.5.0/docs/api/index.html?java/util/regex/Pattern.html.

And for Programmatic Marketing Content, the documentation states that it

Allows you to use a regular expression to search for information in a string. Use any value from the .NET RegexOptions enumeration...

I have never tested the Content builder's Regex Search, but you can try the above syntax and validate if it is the right one. I am not aware of any documentation in regards to this functionality (hopefully, someone from SF sees this and creates a knowledge article at the very least).

  • This documentation appears to be related to Apex, not Marketing Cloud Content Builder. – Eliot Harper Jul 2 '17 at 23:02
  • the only marketing cloud doc I am aware of in regards to regex is for the RegExMatch from the Programmatic Marketing Content developer guide which refers to .Net regular expression standards, which are similar to Java – glls Jul 2 '17 at 23:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.