Skip to main content

Text Ends With

Uncontrolled node

Overview

The Text Ends With node checks whether a given text string ends with a specified pattern or substring. It outputs a boolean value (true or false) based on the result of the check. This node is useful for validating file extensions, checking line endings, or verifying suffixes in text processing workflows.

Inputs

InputTypeDescriptionDefault
TextTextThe string to be checked for the ending pattern.-
PatternTextThe substring or pattern to check for at the end of the text.-

Outputs

OutputTypeDescription
EndsBooleanReturns true if the text ends with the pattern, otherwise false.

Runtime Behavior

This node executes immediately when its inputs are available (uncontrolled behavior). It performs a case-sensitive check using JavaScript's native String.prototype.endsWith() method.

  • If both inputs are valid strings, the node returns true if the text ends with the pattern, otherwise false.
  • If either input is not a string (e.g., null, undefined, or a number), the node returns false by default.
  • The check is case-sensitive: "Hello" will not match "hello" as a pattern.
  • Empty string patterns are valid and will return true for any text input (as every string ends with an empty string).

Example

Checking File Extensions

A common use case is verifying that a filename has a specific extension:

Inputs:

  • Text: "document.pdf"
  • Pattern: ".pdf"

Output:

  • Ends: true

Validating Line Endings

Check if a text block ends with a specific punctuation or terminator:

Inputs:

  • Text: "This is the end."
  • Pattern: "."

Output:

  • Ends: true

Handling Non-String Inputs

If the text input is not a string, the node safely returns false:

Inputs:

  • Text: null (or any non-string value)
  • Pattern: ".txt"

Output:

  • Ends: false