- 3 minutes to read

Formula - endswith

Easily check if text ends with a specific value using the Nodinite endswith Formula plugin. This page shows how to validate message Content, Context, or the output of other formulas, ensuring your integrations are accurate and reliable.

🎯 Designed for business users and integrators β€” no developer required; you can even use AI to craft expressions.

  • βœ… Instantly validate if text ends with a given string from any Payload or Context in any Log Event
  • βœ… Boolean result (true/false) for conditional logic and filtering
  • βœ… Transform and surface meaningful data in Nodinite Log Views, search filters, and self-service diagnostics
  • βœ… Combine with other Formula functions for powerful, layered expressions

What does the endswith Formula do?

The endswith('value', Content) Formula function checks if the provided text ends with the specified value. Use this function to validate data, filter results, or trigger actions based on text endings.


How it works: Input ➜ endswith ➜ Result

graph LR A["Input: Text string"] --> B["endswith('suffix', Content)"] B --> C["Result: true or false"]

Flow: The text is checked to see if it ends with the specified value, returning a boolean result.


Examples

Below are practical examples showing how to check if text ends with a specific value.

Example 1: Check if Message Body Ends With Value

Input

Nodinite

Formula Expression

endswith('inite', body())

Result

true

Ends with Message Body

Example: Checking if message body ends with a value


Example 2: Check if Context Value Ends With Value

Suppose you have a message context value with the key id containing GMT.

Input

GMT

Formula Expression

endswith('T', context('id'))

Result

true

Ends with Message Context

Example: Checking if context value ends with a value


Example 3: Check if Result from Another Formula Ends With Value

You can use the result of another formula function as input. For example, extracting values with regex and checking if they end with a specific character.

Input

GMT UTC

Formula Expression

endswith('C', regex('GMT|UTC', body()))

Result

true

Ends with Formula Function

Example: Using another formula as input for endswith


Features

The endswith Formula function is highly flexible and can be nested with other formula functions. For instance, combine it with regex, jsonPath, or substring to validate extracted or transformed data.

  • Check if text ends with a specific value for data validation
  • Returns boolean true or false for conditional logic
  • Works with message body, Context, or results from other Formula functions
  • Ensures data integrity across integrated systems

Important

The endswith plugin loads the entire message into RAM. Only use this function on small messages to avoid performance issues.


How to use

The endswith formula validates if text ends with a specified string. It's ideal for suffix validation, file extension checks, or conditional filtering.

Syntax

endswith('value', Content)

Parameters:

  • value (string): The suffix string to check for, e.g., 'inite', '.xml', '@example.com'
  • Content (string): The text content to validate, typically from body() or context()

Common patterns:

  • endswith('inite', body()) – Check if body ends with "inite"
  • endswith('.xml', context('filename')) – Validate XML file extension
  • endswith('T', context('timezone')) – Check timezone suffix

Use with different sources:

  • Check message body: endswith('suffix', body())
  • Check message context: endswith('value', context('MessageContextKey'))
  • Check formula result: endswith('C', regex('GMT|UTC', body()))

Next step