0CodeKit icon

0CodeKit

A toolbox of no-code utilities

Actions132

Text → Text Extractor

AI-generated

Overview

The "Text Extractor" operation in the Text resource provides a utility to extract a substring from a given base string. It extracts text that lies between a specified start pattern and an end pattern. This is useful for parsing structured or semi-structured text data where you want to isolate specific information embedded within larger text blocks.

Common scenarios include:

  • Extracting values from logs, emails, or reports where data is enclosed between known delimiters.
  • Parsing user input or scraped web content to retrieve relevant segments.
  • Automating data extraction tasks without writing custom code.

For example, if you have a string like "Name: John Doe\nAge: 30", you can extract the name by setting the start pattern to "Name: " and the end pattern to "\n".

Properties

Name Meaning
Start Pattern The string that marks the beginning of the text to extract.
End Pattern The string that marks the end of the text to extract.
Base String The full string from which the extraction will be performed.
Greedy Whether to extract the last match (true) or the first match (false) when multiple matches exist.
Case Sensitive Whether the matching should consider case differences (true) or ignore them (false).
Return Error if Not Found Whether the node should throw an error if no matching text is found (true) or continue silently (false).

Output

The output contains a JSON field with the extracted substring(s) based on the provided patterns. If the extraction is successful, the output JSON will include the matched text segment(s).

If binary data were involved (not applicable here), it would typically represent files or images, but this node only deals with textual data extraction.

Dependencies

  • Requires an API key credential to authenticate requests against the external service at https://prod.0codekit.com.
  • The node sends a POST request to /text/extractor endpoint with parameters including start pattern, end pattern, base string, and greedy flag.
  • No additional environment variables are required beyond the API key credential.

Troubleshooting

  • No match found: If the start or end pattern does not exist in the base string, the output will be empty unless "Return Error if Not Found" is enabled, in which case the node throws an error.
  • Case sensitivity issues: If extraction fails unexpectedly, verify whether the "Case Sensitive" option is set correctly according to your input text.
  • Multiple matches: By default, the node extracts the first match. Enable "Greedy" to extract the last match instead.
  • Invalid patterns: Ensure that the start and end patterns are correct and do not contain unintended characters or escape sequences.
  • API errors: Check that the API key credential is valid and has proper permissions. Network issues or service downtime may cause failures.

Links and References

Discussion