Visit ComfyUI Online for ready-to-use ComfyUI environment
FilterLinesBySubstrings: Node filters text lines based on specified substrings for focused data analysis and content manipulation.
The FilterLinesBySubstrings
node is designed to process a block of text by filtering its lines based on the presence or absence of specified substrings. This node is particularly useful when you need to extract or exclude lines containing certain keywords or phrases from a larger text, allowing for more focused data analysis or content manipulation. By specifying substrings and choosing whether to retain or remove lines containing these substrings, you can efficiently manage and refine text data. This functionality is essential for tasks that require text cleaning, data preprocessing, or content curation, making it a valuable tool for AI artists who work with text-based data.
The input_text
parameter is a multiline string that represents the text you want to process. It serves as the source from which lines will be filtered based on the specified substrings. This parameter is crucial as it provides the raw data that the node will analyze and manipulate. There are no specific minimum or maximum values, but it is important to ensure that the text is formatted correctly with lines separated by newline characters.
The substrings
parameter is a string containing one or more substrings separated by the pipe (|
) character. These substrings are the criteria used to filter the lines in the input_text
. The node will check each line to see if it contains any of these substrings. The default value is "查找符1|查找符2", which means you can specify multiple substrings to search for within the text. This parameter is essential for defining the filtering criteria and directly impacts which lines are retained or removed.
The action
parameter determines whether lines containing the specified substrings should be retained or removed. It offers two options: "保留" (retain) and "移除" (remove), with "保留" being the default. This parameter is critical as it dictates the node's behavior in terms of filtering, allowing you to either focus on lines of interest or clean the text by removing unwanted lines.
The output is a single string that contains the filtered lines from the input_text
. The lines are joined together with newline characters, preserving the original order. This output is significant as it provides the refined text data after the filtering process, which can be used for further analysis or processing. The result reflects the action specified, either retaining or removing lines based on the presence of the substrings.
substrings
parameter, separated by the pipe (|
) character.action
parameter to specify whether you want to keep or discard lines containing the substrings, depending on your data processing needs.input_text
is properly formatted with lines separated by newline characters to avoid unexpected results.substrings
or action
parameters.substrings
are separated by the pipe (|
) character and that action
is set to either "保留" or "移除".RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Playground, enabling artists to harness the latest AI tools to create incredible art.