ecm:regexMatchesIgnoreCase
    • 1 Minute to read
    • Dark
      Light

    ecm:regexMatchesIgnoreCase

    • Dark
      Light

    Article summary

    ​The function ecm:regexMatchesIgnoreCase checks to see if a specified value matches a given regular expression. It ignores whether the target string text is written in upper or lowercase. The value returned is a Boolean data type.

    Example

    A message is customized for recipients residing in London, Paris or Milan. However, the value saved in the attribute is not always formatted properly, for example, london/pARIS/mIlAn. The placeholder should insert the text when the attribute value matches regardless of how it is written. A line of text is inserted into the message using an ​InsertIf​ statement, which is structured as follows:

    <%InsertIf expression="${((ecm:regexMatchesIgnoreCase(user.customAttribute['City'],'(London|Paris|Milan)')))}"%>Text<%/InsertIf%>

    The characters included in the regular expression define the query as follows:

    • The parenthesis ​( )​ define the subexpression, in this case, the three cities to be considered for the personalization.

    • The vertical bar (​|​) separates alternative items included in the query

    The whole regular expression must match to be true. For example, if you want to check if an email contains AOL, you must include variables that take into account any characters that could appear before or after AOL in the target string

    Structure​

    ecm:regexMatchesIgnoreCase(string, string)

    Parameters​

    Parameter

    Description

    string

    Specifies the target string that is queried against the regular expression.

    string

    The regular expression, in single quotes. The regular expression defines how the query is performed (see http://en.wikipedia.org/wiki/Regex).


    Was this article helpful?