Visit ComfyUI Online for ready-to-use ComfyUI environment
Extracts text before a specified keyword, with case sensitivity and whitespace trimming for clean output.
The TextBeforeKeyword node is designed to extract a portion of text that appears before a specified keyword within a given string. This node is particularly useful for text processing tasks where you need to isolate or manipulate text segments based on the presence of certain keywords. By allowing you to specify whether the search should be case-sensitive, it provides flexibility in handling text data with varying capitalization. The node efficiently identifies the keyword's position and returns the text preceding it, trimming any trailing whitespace to ensure clean output. This functionality is beneficial for AI artists who need to preprocess text data for further analysis or creative applications.
The text parameter is the main input string from which you want to extract the portion before the specified keyword. It supports multiline input, allowing you to work with extensive text blocks. The default value is "Your text here", which serves as a placeholder for your actual text input. This parameter is crucial as it provides the content that the node will process to find the keyword and extract the preceding text.
The keyword parameter is the specific word or phrase you want to search for within the input text. It is a single-line input, meaning it does not support multiline entries. The default value is "keyword", which you should replace with the actual keyword you are interested in. This parameter determines the point in the text where the extraction will occur, making it essential for the node's operation.
The case_sensitive parameter is a boolean option that dictates whether the keyword search should consider case differences. By default, it is set to True, meaning the search will be case-sensitive. If set to False, the node will convert both the text and keyword to lowercase before searching, allowing for case-insensitive matching. This parameter is important for ensuring that the keyword search aligns with your specific requirements regarding text capitalization.
The processed_text output parameter provides the extracted portion of the input text that appears before the specified keyword. If the keyword is not found, the entire input text is returned. This output is crucial for further processing or analysis, as it isolates the desired text segment based on the keyword's position. The node ensures that the output is free of trailing whitespace, providing a clean and ready-to-use text segment.
case_sensitive parameter according to the capitalization of your text data. Use True for exact matches and False for more flexible, case-insensitive searches.text parameter to input your data efficiently. This can help in processing extensive documents or text data without manual segmentation.case_sensitive to False if the keyword might appear in different capitalizations.text parameter is left empty or contains only whitespace.text parameter contains valid content before processing. Provide a meaningful text input to extract data from.keyword parameter is left empty or contains invalid characters.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.