Wrap Matched Frontend Content with the QCDR {match} Placeholder

The Wrap it using {match} action lets a QCDR Rule place new content around the original match. Put the literal {match} placeholder exactly where the original matched output should be inserted into the wrapper.

How Wrap Works

At runtime, QCDR resolves the Rule's replacement content and substitutes the original matched text/markup wherever {match} appears. A direct HTML wrapper such as <span class="notice">{match}</span> therefore preserves the original match inside the new element.

If the replacement contains {match} more than once, the original match is inserted at each placeholder. Use one placeholder unless repeating the original content is intentional.

Create a Wrap Rule

  1. Create or edit a Rule and leave it Draft during setup.
  2. Enter the rendered value in Find this.
  3. Choose Wrap it using {match} as the Action.
  4. Choose a Replacement source. For a direct HTML wrapper, select Enter a value and HTML or formatted content.
  5. Enter the wrapper and place {match} where the original content belongs.
  6. Set page targeting and occurrence behavior so only the intended matches are wrapped.
  7. Save and verify the result before enabling the Rule broadly.

Do Not Omit {match} by Accident

The current runtime has a compatibility fallback when a Wrap replacement contains no {match}: it outputs the replacement immediately before the original match. That preserves the original output, but it is not a true wrapper. Do not rely on that fallback for a new Rule; include {match} deliberately.

Using a Token as the Wrapper

A Wrap Rule can use a QCDR Token as its Replacement source. The resolved Token output must contain the literal {match} where the original content should appear. If the Rule depends on a Token and Token processing is unavailable, QCDR leaves the original match untouched rather than applying an empty wrapper.

Test HTML Structure and Repeated Matches

Wrapping changes markup boundaries, so test the final DOM/layout as well as the visible text. If the find value occurs more than once, the occurrence controls determine which matches receive the wrapper. Keep the Rule narrowly scoped until you have confirmed that repeated wrappers do not create invalid nesting or unwanted styling.


Community Discussion

Want to compare workflows, share practical tips, or discuss how you use this QCDR feature? Visit the QC Dynamic Replacer Community. For private support, bug reports, account-specific issues, or feature requests, use the QuantaCade support system.