{colonescape:text}

Description

Replaces every colon in the given text with the escaped form #: , the marker AA uses for a literal colon. AA splits command parameters on the colon, so any colon inside a value would otherwise be read as a separator and break the call. colonescape protects such values - typically a time like 16:45, a URL, or any field or nested-command result that contains a colon - so the whole string is passed on as a single parameter. The text is not trimmed, and a literal colon written directly in the call is split off before it reaches colonescape, so feed the value from a field, an alias, or a nested command (or write the colon as #: yourself). This is a low-level helper; most often you let AA escape colons for you and reach for colonescape only when building a value to hand to another command.

Parameters

text required

The text whose colons should be escaped. Every colon in it is replaced with the escaped form #: so AA reads it as a literal colon, not a parameter separator. A literal colon written directly in the call is split off before it reaches this parameter - feed the value from a field, an alias, or a nested command, or write the colon as #: yourself.

Examples

test{colonescape:16:45}
Expected16
Actual16
A bare colon in a literal argument is read as a parameter separator, so only the part before it (16) reaches colonescape; 45 is discarded. This is why the function exists - hand-written colons need protection.
test{colonescape:16#:45}
Expected16#:45
Actual16#:45
Writing the input colon as #: lets the whole string 16:45 reach colonescape as one argument; it then re-escapes the colon back to #:. Use this form to carry a literal colon value inline.
test{colonescape:plain text}
Expectedplain text
Actualplain text
No colon means no change. Note the space is preserved - colonescape does not trim its argument.
test[{colonescape:}]
Expected[]
Actual[]
An empty argument returns an empty string. Brackets are added only to make the empty result visible.
test{colonescape:{str_replace:_:#::10_30}}
Expected10#:30
Actual10#:30
The real use. str_replace builds the value 10:30 at runtime; that colon is not a separator (it arrives after parameter splitting), and colonescape turns it into 10#:30 so a later command can take it as one argument.
test{switch:{colonescape:{str_replace:_:#::open#:now}}:^open:matched:other}
Expectedmatched
Actualmatched
The canonical pattern. The value open:now would split switch into two parameters; colonescape converts it to open#:now so switch sees a single condition, and the regex ^open matches.