Skip to main content

r:replace

<r:replace />

This tag uses regular expressions to replace the content inside the tag with whatever characters you specify.

Attribute Options:

  • match - The regular expression pattern to use to match what characters to replace. String.
  • with - The characters to replace what was matched in the match attribute. String.

Examples:

<r:replace match="WordPress" with="CleanSlate">
  WordPress is the best CMS.
</r:replace>
<!-- Output: "CleanSlate is the best CMS." -->
<!-- RegEx matches any digit -->
<r:replace match="\d" with="A">123</r:replace>
<!-- Output: "AAA" -->
<!-- Regex to grab individual strings, sans commas and spaces -->
<!-- Regex from: https://stackoverflow.com/a/5001626 -->
<r:replace match="[^,\s][^\,]*[^,\s]*" with="Renamed tag">
  tag_1, tag 2, label-3, example
</r:replace>
<!-- Output: "Renamed tag, Renamed tag, Renamed tag, Renamed tag" -->

Last updated on January 23, 2020.

We welcome all questions, feedback and bug reports. If you're having an issue, we usually need the following information:

  • A brief description of the issue
  • A link to the page where you saw the issue
  • Screenshots that illustrate the problem - How do I take a screenshot?

Kindly email CleanSlate@mail.wvu.edu for help or use the form on the request help page.