Text processing and custom formats
A format transforms an extracted or explicitly supplied value. Choose native text processing, a path-only template or a supported Browser custom function. Opening an existing format does not automatically convert it.
Native text processing
Section titled “Native text processing”Native processing can be used across supported targets without page JavaScript. Its optional operations run in this fixed order:
- Trim removes boundary whitespace.
- Clean replaces literal case-insensitive
text with spaces; it is not general HTML decoding. - Normalize whitespace collapses whitespace runs to one space, without a second automatic trim.
- Replace replaces exact literal text, case-sensitively; no regular-expression replacement.
- Letter case applies lower/upper conversion.
- Regex extracts the first match or selected capture using the supported RE2 syntax. No match is an error; JavaScript lookaround/backreferences are unavailable.
- Number conversion parses the complete remaining text with explicitly selected decimal/thousands separators.
For a displayed price such as 1,234.50, choose matching separators. Remove a currency suffix explicitly before converting it. Partial numeric parses and automatic currency guessing are not supported.
An explicit format input takes precedence over extraction. Without one, a compatible extraction value is required. Native number output is not valid for an action such as Type that requires text.
Templates
Section titled “Templates”A template produces text from literal segments and references such as ${params.search} or extraction-local ${currentValue}. It does not execute arithmetic or methods such as .trim(). Use native processing or an explicit custom function for transformation.
See variables for exact keys, arrays and loop context. Template code and an existing literal that happens to contain ${...} are different authored modes.
Set: first result or collection
Section titled “Set: first result or collection”Without a separator, locator Set reads the first selected match. Explicit separator presence enables collection; an empty separator concatenates text without additional characters.
One result keeps its type. Multiple text results join with the separator. Multiple plain objects shallow-merge in selected order, with later keys winning; nested values are replaced as a whole. Mixed text/object/scalar collections and array aggregation are not implicitly coerced. An empty selection is an error and assigns no new value.
Track field aggregation has separate rules; do not assume Set’s object merge applies to collected fields. A configured Set connector receives the complete successful result once, not each extracted element.
Browser custom formats
Section titled “Browser custom formats”Custom source is an ordinary or async JavaScript function expression. Use an ordinary function when accessing this, for example:
function(args) { return this.currentValue.replace(args.from, args.to);}Literal format arguments might be { "from": "USD ", "to": "" }. These are function arguments, not automatic named scenario inputs. Supply a scenario value explicitly using the format’s Input value binding when needed.
this.currentValue contains the supplied/extracted value; this.element is the selected element when available; this.context supplies supported action/loop context. Return a supported JSON value for the consuming action. Custom formats are Browser-only.
The advanced Run in page context choice is explicit per function and is needed for page-owned globals/libraries. That environment is shared with the site; supply only data you intend the page to see. Stop/deadline does not undo DOM changes or external effects.
Custom Code versus a format
Section titled “Custom Code versus a format”Custom Code executes a Browser function and can show its return as diagnostic output. It does not assign that return to a working variable automatically. Its optional Input value is explicit and independent of its locator. Use Set with a format when the purpose is assigning a value.
Type can also consume supported native/template/custom processing: its locator is the typing destination, not an extraction source. If a format is present, it takes precedence over the separate Typed text value.