Variable can be extended to produce various functions.Generating a new result string does not affect the original variable!
Search, replace, and delete
A =/12/123/ABC
Replace the first appearance place from left to right: $ {A/12/}=>/// 123/ABC
Place where the first appearance starts from left to right: $ {A/#12/}=>/12/123/ABC, and $ {A/# \/12/} =>/123/ABC
Place where the first appearance starts from right to left: $ {A/% ABC/} =>/12/123 /, $ {A/% \/ABC/} =>/12/123
Replace all occurrences: $ {A // 12/} => // 3/ABC
Delete pattern matching
A =/12/123/ABC
Delete the left mode and the shortest match: $ {A/# * 12} =>/123/ABC
Delete the left mode and longest match: $ {A/# * 12} => 3/ABC
Delete the right mode and the shortest match: $ {A/% 12 */} =>/12/
Delete right mode and longest match: $ {A/% 12 */} =>/
Variable substring
A =/12/123/ABC
Extract the string from the start position on the left: $ {Variable: Start position (non-negative) }:: {A: 2 }=>/123/ABC
Offset from the right to the start position, and capture the string on the right [or the string from the start position on the right to the left]: $ {Variable: Start position (negative number )}: $ {A :(-2) }=> BC, note that negative numbers must be included
Extract the string of the specified length from the start position on the left to the right: $ {Variable: Start position (non-negative): length (non-negative) }:$ {A: 2: 7 }=> 2/123/
Offset from the left to the start position from the Right, and extract the string of the specified length from the right: $ {Variable: Start position (non-negative): length (non-negative )}: $ {A :(-2): 1 }=> B. Note: If the length is greater than or equal to the absolute value of the start position, it is equivalent to the truncation function.
Calculate the length of the variable's substring
A =/12/123/ABC
$ {# A} = 11