pyrit.prompt_converter.WordRegexSelectionStrategy#
- class WordRegexSelectionStrategy(*, pattern: str | Pattern)[source]#
Bases:
WordSelectionStrategySelects words that match a regex pattern.
- __init__(*, pattern: str | Pattern) None[source]#
Initializes the word regex selection strategy.
- Parameters:
pattern (Union[str, Pattern]) – The regex pattern to match against words.
Methods
__init__(*, pattern)Initializes the word regex selection strategy.
select_range(*, text[, word_separator])Selects a character range by first selecting words, then converting to character positions.
select_words(*, words)Selects words that match the regex pattern.