Skip to main content
For the complete documentation index for agents and LLMs, see llms.txt.

DeepsetRegexParser

Extract text from a string or chat message using a regular expression pattern.

Deprecation Notice

This component is deprecated. Use RegexTextExtractor from Haystack instead. Existing pipelines that use this component continue to work for now.

Key Features

  • Extracts text using a regex pattern with capture groups.
  • Accepts plain strings or lists of ChatMessage objects as input.
  • Can search all messages or only the last message in a chat history.
  • Supports returning a single match or all matches.

Configuration

  1. Drag the DeepsetRegexParser component onto the canvas from the Component Library.
  2. Click the component to open the configuration panel.
  3. Enter the regex_pattern with at least one capture group to extract the desired text.
  4. Configure consider_all_messages, return_all_matches, and return_empty_on_no_match as needed.

Connections

DeepsetRegexParser accepts text_or_messages as input — either a string or a list of chat messages. It outputs captured_text for a single match or captured_texts for multiple matches.

Connect a Generator or chat component to the input. Connect the output to components that need the extracted value, such as DeepsetGitHubIssueViewer.

Usage Example

This example extracts a URL from a chat message:

components:
regex_parser:
type: deepset_cloud_custom_nodes.parsers.regex_parser.DeepsetRegexParser
init_parameters:
regex_pattern: '<issue url="(.+)">'
consider_all_messages: false
return_empty_on_no_match: false
return_all_matches: false

inputs:
text_or_messages:
- regex_parser.text_or_messages

outputs:
captured_text: regex_parser.captured_text

Parameters

Inputs

ParameterTypeDefaultDescription
text_or_messagesstr or List[ChatMessage]Text or chat messages to search.

Outputs

ParameterTypeDefaultDescription
captured_textstrFirst captured text when return_all_matches is False.
captured_textsList[str]All captured texts when return_all_matches is True.

Init Parameters

These are the parameters you can configure in Pipeline Builder:

ParameterTypeDefaultDescription
regex_patternstrRegular expression pattern with a capture group to extract text.
consider_all_messagesboolFalseIf True, applies the regex to all chat messages. If False, only the last message is searched.
return_empty_on_no_matchboolFalseIf True, returns an empty dictionary when no match is found.
return_all_matchesboolFalseIf True, returns all matches as captured_texts. If False, returns only the first match as captured_text.

Run Method Parameters

These are the parameters you can configure for the component's run() method. This means you can pass these parameters at query time through the API, in Playground, or when running a job. For details, see Modify Pipeline Parameters at Query Time.

ParameterTypeDefaultDescription
text_or_messagesstr or List[ChatMessage]Text or chat messages to search.