Advanced Phrase Substitution in the UI

This topic describes how to make advanced phrase substitutions.

To understand how phrase substitution works, you might find it helpful to read Simple Phrase Substitution in the UI.

CAUTION:
Keep in mind that because your phrase substitutions are part of your theme, they will be overridden if you change your site's theme. When you upgrade, they will be overwritten and you'll have to recreate them.

On the Phrase Substitution Rules page (Admin Console: System > Settings > Phrase Substitutions), you can change the rule or get more information about it. (You can also get to this page from the System > Settings > Themes page by editing a theme and then clicking Edit Rules.)


Advanced Phrase Substitution Rules

On this page you can:


View Rule Results

Creating a New Advanced Rule

When you need more fine-grained control over your substitution, you can create an advanced rule. You can do this in the Admin Console by editing the custom theme with which the new rule will be associated. In the console, click System > Settings > Themes, then click the edit icon for the theme to which you want to add the rule. On the Edit Theme page, click Edit Rules. On the Phrase Substitution Rules page, click Add Rule.

When you're adding a rule this way, you'll have four values to enter:
Rule Option Value Description
Target Value or Key Whether the rule should be looking for your pattern (what you're replacing) in the i18n values or keys. If you choose "Key" here, the substitution will still be for the key's value, not the key itself. This is handy when you know what a particular key is and want to focus on that one in particular.
Operator Equals, Contains, Starts With, Ends With, or Regular Expression. The first four values are self-explanatory. The last specifies that your pattern is a "regular expression".
Pattern The original string. The pattern that should be sought for replacement. For example, if you'd specified "Regular Expression" as your operator, you could enter "\bblog\b" for a pattern that matches the word "blog" (as opposed to "blogger"). The "\b" combination in regular expression can be used to indicate the boundary of a word.
Replace With The replacement string. The text to substitute instead of the text you enter for a pattern.