Houdini 18.0 Nodes TOP nodes

Attribute from String TOP node

Parses attribute values from a string, such as a file name.

On this page

The node lets you choose between using a simple pattern replacement language, or full-on regular expressions. The simple patterns are easier to write and make sense to use for structured strings with separators.

Simple pattern language

This node supports a fairly simple pattern language, alternating named "capture" groups and literal characters. The strings captured by the groups are assigned to attributes. This can be useful for parsing information out of file names, if the name has a regular structure with separator characters.

For example, given "source" file names in the form:


You can parse the different parts into attributes using a pattern such as:


(Empty braces capture a string but aren’t assigned to an attribute.)

  • In the pattern, curly braces ({name}) match up to the next literal character in the pattern.

    • If the braces are empty, the matching string is thrown away.

    • The braces contain a name, the matching string is assigned to an attribute with that name. For exmaple, the part of the source string "captured" by {shot} is assigned to the shot attribute.

    • If Infer attribute type is on, the node guesses the attribute type based on the matched string (if it looks like a whole number, it’s an integer; if it looks like a number with a decimal point, it’s a float; otherwise it’s a string). You can explicitly specify the type using {name:type}. For example, {shot:string}, {frame:int}, {time:float}.

  • If you have capture braces at the end of the pattern, they match to the end of the source string.

  • Outside braces, characters in the pattern must match characters in the source string exactly.

  • Braces are not "greedy"… they only match up to the next literal character, even if going further would give a better match.

    For example, in day.01.csv, with the pattern {name}.csv you might expect {name} to capture day.01, but in fact it will only capture day (since it captures up to the next literal character, a period). The pattern will then fail because it expects the characters after the period to be csv, not 01.

  • The whole pattern must match the source string (not just a prefix).

  • If the whole pattern doesn’t match, none of the attributes in the pattern will be set.

Regular expression

For maximum power/flexibility, you can use a regular expression instead. This node uses Python’s regular expression syntax.

  • Using a regular expression implies Infer attribute type.


Work Item Generation

Whether this node generates static or dynamic work items. You should generally leave this set to "Automatic" unless you know the node’s work items can be computed statically, or that they need to be generated dynamically.


This node always creates dynamic work items: it waits until the upstream work items are known, and generates new work items from the upstream work items.


This node always creates static work items: it creates the number of work items it thinks it needs based on the parameters (and any upstream static items) before the network runs.


If the input is static (a static processor, or a partitioner with only static inputs, or a mapper), this node generates static work items, otherwise it generates dynamic work items.

Source String

The string containing data you want to parse. Usually this is an expression to get the string from an attribute. Since this is a string parameter, you need to enclose the expression in back-ticks. For example: `@name`


Determines which operation to perform on the source string. Match by String will extract components from the Source String using a pattern and store them as attributes. Split by Delimiter will split the source string based on a secondary string and store the resulting substrings as attributes.

Match by Pattern

Pattern Type

Determines if the Pattern field is using the simple brace syntax or a regular expression. When using a regular expression, captured groups are assigned to attributes by number, for example, group0, group1, and so on. If the capture groups are named, e.g. using the syntax (?P<name>), then the attribute name is set to the capture group name.


The pattern to use to extract attributes from the Source string. The language is controlled by the Use custom regex checkbox. When the checkbox is off, this parameter uses a simple pattern substitution language (see above). When the checkbox is on, this parameter is a regular expression.

Infer Attribute Type

When this is on, if you don’t explicitly state the type of a capture pattern (for example, {shotnum:int}), the node will try to guess the type based on the matched string content (if it looks like a whole number, it’s an integer; if it looks like a number with a decimal point, it’s a float; otherwise it’s a string).

Create Items With No Matches

By default, the node only creates new work items from incoming items where the pattern matched. When this is on, work items are passed through even if they didn’t match.

Split by Delimiter

Delimiter Type

Specified what type of delimiter to use for splitting the Source String. Using String will split the source string based on the exact contents of the Delimiter field. Character Set attempts to split based on each of the delimiter characters individually. Regular Expression will interpret the Delimiter as a custom regex.


The delimiter to use when splitting the source string.

Store Result As

How the split string is stored. The components can either be stored as a string array attribute on a single work item, or split into one work item per component.

Trim Whitespace

When this toggle is enabled, leading and trailing whitespace is removed from the components after splitting the string.


example_top_attributefromstring Example for Attribute from String TOP node

This example demonstrates how to create attributes for workitems from a piece of string attribute coming from upstream.

See also

TOP nodes