View all expressions
Transformation

Split Text Layer by Separator

Splits a text layer’s name or content into two or more parts based on a separator (e.g., hyphen, colon, or space) and extracts either the first or second part. Note: You can experiment with different separators by changing the character inside the brackets (” “). To split into more than two parts, follow the same method.

Contributed by:


thisComp.layer("Main Text Layer").text.sourceText.split(" ") [0] // First part
thisComp.layer("Main Text Layer").text.sourceText.split(" ") [1] // Second part
thisComp.layer("Main Text Layer").text.sourceText.split(" ") [2] // Third part (this can continue indefinitely, depending on how many parts you need)

Split Text Layer by Separator

Practical use case

Perfect for automating text-based workflows where layers have structured names like “Title - Subtitle” or “Section: Topic,” allowing you to use each part independently.

Check out similar expressions

Data-driven video workflows for After Effects are easier with Plainly.

a mesh of elegant lines transparent image