Ido Toolbox icon

Ido Toolbox

A comprehensive collection of useful tools for data processing, text manipulation, and daily operations

Other Tool → Get Numeric Characters

AI-generated

Overview

This node, part of the "Ido Toolbox," provides a variety of utility operations for data processing and text manipulation. The specific operation "Get Numeric Characters" extracts all numeric characters from a given input string. It can either return these characters as a concatenated string or as an array of numbers.

This operation is useful in scenarios where you need to isolate digits from mixed content strings, such as extracting phone numbers, IDs, or numeric codes embedded within text. For example, if you have a product code like "AB123CD45", this operation can extract "12345" either as a string or as an array of individual digits.

Properties

Name Meaning
Input String The string from which numeric characters will be extracted.
Extract as Numbers Whether to return the extracted numeric characters as an array of numbers (true) or as a concatenated string (false).

Output

The output JSON object contains the following fields:

  • inputString: The original input string provided.
  • numericString: A string consisting of all numeric characters extracted from the input, concatenated in order.
  • numbers (optional): An array of numbers representing each extracted digit individually. Present only if "Extract as Numbers" is set to true and there are numeric characters.
  • count: The total number of numeric characters found in the input string.

Example output when extracting as numbers:

{
  "inputString": "Order #A123B456",
  "numericString": "123456",
  "numbers": [1, 2, 3, 4, 5, 6],
  "count": 6
}

Example output when not extracting as numbers:

{
  "inputString": "Order #A123B456",
  "numericString": "123456",
  "count": 6
}

Dependencies

  • No external services or API keys are required.
  • This node operates purely on the input string using built-in JavaScript functionality.
  • No special environment variables or n8n configurations are needed.

Troubleshooting

  • If the input string is empty or contains no numeric characters, the output will have an empty numericString and a count of zero. The numbers array will be absent if extraction as numbers is enabled but no digits are found.
  • Ensure the input string is properly provided; otherwise, the result will be empty.
  • No explicit error messages are thrown by this operation related to input format since it safely handles any string input.

Links and References

Discussion