Visit ComfyUI Online for ready-to-use ComfyUI environment
Automate text pattern replacement with random selections for creative AI text manipulation.
The Simple Pattern Replace (WLSH) node is designed to facilitate the replacement of specific patterns within a given text string with random selections from a provided list of strings. This node is particularly useful for AI artists who need to dynamically alter text content based on predefined patterns, making it easier to generate varied and creative outputs. By leveraging this node, you can automate the process of text manipulation, ensuring that specific patterns are consistently replaced with diverse alternatives, thereby enhancing the variability and creativity of your text-based projects.
This parameter represents the original text string in which you want to replace specific patterns. It is the primary input where the search and replace operation will be performed. The content of this string will be scanned for occurrences of the specified pattern, which will then be replaced with random selections from the provided list of strings.
This parameter is a string containing multiple replacement options, separated by a specified delimiter. These options will be used to replace the identified patterns in the input string. The list should be formatted as a single string with each replacement option separated by the delimiter you choose.
The pattern parameter defines the specific sequence of characters you want to search for within the input string. This pattern will be escaped to handle special characters and stripped of any leading or trailing whitespace before the search operation. It is crucial to accurately define this pattern to ensure the correct parts of the input string are identified for replacement.
This parameter specifies the character or sequence of characters used to separate the different replacement options within the list_string. It is essential that this delimiter is present in the list_string; otherwise, the node will raise an error. The delimiter helps the node to correctly parse the list_string into individual replacement options.
The seed parameter is an optional input that allows you to set a specific seed for the random number generator. By providing a seed, you can ensure that the random selections from the list_string are reproducible, which is useful for achieving consistent results across multiple runs. If no seed is provided, the random selections will vary each time the node is executed.
The new_string output parameter contains the modified version of the input string, where all occurrences of the specified pattern have been replaced with random selections from the list_string. This output provides the final text after the replacement operation, ready for further use or processing in your project.
© Copyright 2024 RunComfy. All Rights Reserved.