oxy_replace() Function

The oxy_replace function is used to replace a string of text.

The oxy_replace() function has two signatures:

  • oxy_replace ( text , target , replacement )

    This function replaces each substring of the text that matches the literal target string with the specified literal replacement string.

    text
    The text in which the replace will occur.
    target
    The target string to be replaced.
    replacement
    The string replacement.
  • oxy_replace ( text , target , replacement , isRegExp )

    This function replaces each substring of the text that matches the target string with the specified replacement string.

    text
    The text in which the replace will occur.
    target
    The target string to be replaced.
    replacement
    The string replacement.
    isRegExp
    If true the target and replacement arguments are considered regular expressions, if false they are considered literal strings.
Suppose that you have image references but you want to see other thumbnail images that reside in the same folder in the visual Author editing mode:
image[href]{
 content:oxy_url(oxy_base-uri(), oxy_replace(attr(href), '.jpeg', 'Thumbnail.jpeg'));
}