Houdini 20.5 Nodes APEX nodes

string::PatternRename

Performs pattern replacement in a string.

On this page
Since 20.5

Performs pattern replacement of a string by first finding occurrences of the find pattern in the input string. The output string is then formed by replacing occurrences of find with replace in the input string.

For example, to change a string that starts with “bob” to a string that starts with “carol”:

find

replace

bob*

carol*

To replace “hand” with “foot” in the middle of a string:

find

replace

*hand*

*foot*

To reorder the matched words in the result, the replace pattern can use numbered wildcards like *(0), *(1), *(2), etc. For example, to swap words in a string where the words are separated by an underscore _:

find

replace

result

*_*

*(1)_*(0)

a_x” changes to “x_a

To match a single character, use ? instead of *. In this case, the replace pattern must also use ? instead of *. Similarly, the wildcards are then numbered using ?(0), ?(1), ?(2), etc.

Inputs

input: String

The string to perform pattern replacement on.

find: String

The pattern to update in the input string.

replace: String

The pattern that replaces find in the input string.

Outputs

result: String

The resulting string after performing the pattern replacement.

See also

APEX nodes