{post_str_replace:search:replace}

Description

Reserves a search-and-replace pair to run on the whole finished page after every other expression has expanded - the deferred companion to str_replace. Important: this command is registered but its action is disabled in the engine, so right now it always expands to an empty string and replaces nothing; both parameters are accepted but ignored. To replace text today, use str_replace, which acts immediately on a third text argument. The deferred form exists so a replacement can reach text that other commands or included views generate later in the page, which str_replace cannot see. If a future release enables it, the call would still output nothing where written and the replacement would be applied once, last, across the entire output. Also grouped with String Manipulation.

Parameters

search optional default (empty)

The text to look for. Currently has no effect because the command's action is disabled in the engine; both parameters are read but nothing is replaced.

replace optional default (empty)

The text that would take the place of each match. Currently has no effect for the same reason; the call always expands to an empty string.

Examples

test[{post_str_replace:cats:dogs}]
Expected[]
Actual[]
The command is registered but its action is disabled in the engine, so it expands to an empty string and changes nothing.
testbefore-{post_str_replace:cats:dogs}-after
Expectedbefore--after
Actualbefore--after
Because the command emits nothing, only the bracketed call disappears; the text around it is left exactly as written.
test[{post_str_replace::}]
Expected[]
Actual[]
Even with no search or replace value the result is the same empty string - the action is disabled regardless of input.
test{str_replace:cats:dogs:I have two cats}
ExpectedI have two dogs
ActualI have two dogs
To actually replace text today, use str_replace, which takes a third parameter (the text to act on) and runs immediately.
virtual{post_str_replace:PLACEHOLDER:Welcome}
Expected(empty here; if enabled, every PLACEHOLDER in the final page output becomes Welcome)
Intended design, currently disabled in the engine. Unlike str_replace it would register the pair and run on the WHOLE finished page after every other expression, so it could replace text that other commands produced. The call itself stays empty where written.
virtual{post_str_replace:__BRAND__:ActionApps}some view outputs __BRAND__ here
Expected(if enabled: some view outputs ActionApps here)
Actualsome view outputs __BRAND__ here
The reason a deferred form exists: str_replace cannot touch text that is generated later in the page. A registered post replacement runs last, so it could rewrite a marker emitted by an included view or another expression.