Skip to Content

String Methods

In Find & Replace mode, the special variable old refers to the current value being replaced. It is automatically wrapped in a StringWrapper that provides string manipulation methods you can call directly.

The old variable is only available in Find & Replace context. In other contexts (Tabular Operations, CSV), fields are accessed by name directly.

Available methods

Case conversion

MethodDescriptionExampleResult
old.toUpperCase()Convert to uppercase{{old.toUpperCase()}}"HELLO WORLD"
old.toLowerCase()Convert to lowercase{{old.toLowerCase()}}"hello world"

Trimming and padding

MethodDescriptionExampleResult
old.trim()Remove leading/trailing whitespace{{old.trim()}}"hello"
old.padStart(len, char)Pad from the start{{old.padStart(5, "0")}}"00042"
old.padEnd(len, char)Pad from the end{{old.padEnd(10, ".")}}"hello....."

Extraction

MethodDescriptionExampleResult
old.substring(start, end?)Extract by index range{{old.substring(0, 5)}}"hello"
old.slice(start?, end?)Extract by index (negative OK){{old.slice(-3)}}"rld"
old.charAt(index)Get character at index{{old.charAt(0)}}"h"
old.charCodeAt(index)Get char code at index{{old.charCodeAt(0)}}104
MethodDescriptionExampleResult
old.includes(str)Check if string contains substring{{old.includes("@")}}true or false
old.indexOf(str)Find position of substring{{old.indexOf("@")}}5 (or -1 if not found)

Transformation

MethodDescriptionExampleResult
old.replace(search, replacement)Replace first occurrence{{old.replace("http", "https")}}"https://..."
old.split(separator)Split into array{{old.split(",")}}["a","b","c"]

Length

MethodDescriptionExampleResult
old.length()Get string length{{old.length()}}11

length() is a method call, not a property. You must use parentheses: {{old.length()}}. Writing {{old.length}} without parentheses will not work — it will return undefined.

Practical examples

Append a suffix

Search: user Replace: {{old + "_backup"}} Result: user_backup

Extract domain from email

Search: alice@example.com Replace: {{old.split("@")[1]}} Result: example.com

Array indexing with [1] works here because old.split("@") returns a JavaScript array, and the expression engine evaluates the member access naturally.

Upgrade HTTP to HTTPS

Search: http://example.com Replace: {{old.replace("http://", "https://")}} Result: https://example.com

Pad numeric IDs

Search: 42 Replace: {{old.padStart(6, "0")}} Result: 000042

Conditional based on content

Search: some-value Replace: {{old.includes("error") ? "FLAGGED: " + old : old}}

Ternary expressions (? :) are not supported by the expression engine. The example above will not work. Use the expression engine’s comparison operators with the Tabular Operations or Compute features for conditional logic instead.

Chaining methods

Methods can be chained together:

{{old.trim().toLowerCase()}} {{old.split("-")[0].toUpperCase()}}

Note that once a method returns a plain string (not a StringWrapper), further method calls use native JavaScript string methods. In practice this works the same way since StringWrapper methods mirror native string methods.

The old variable with non-string values

The old variable works with any value type — numbers, booleans, arrays, and objects are all converted to their string representation before string methods are applied.

// If old value is the number 42: {{old.toString()}} → "42" {{old.padStart(5, "0")}} → "00042" // If old value is the boolean true: {{old.toUpperCase()}} → "TRUE"
Last updated on