analyse_pattern#
- scikitplot.cleanprompt.analyse_pattern(source, flags=0)[source]#
Report the shapes in
sourcethat can backtrack catastrophically.- Parameters:
- sourcestr
A regular expression, as written in a pack.
- flagsint, default=0
The
reflags the pattern is compiled with (case folding changes which characters overlap).
- Returns:
- tuple of PatternRisk
Empty when no known risky shape is present. A source this parser cannot model gives one
not-analysedfinding rather than nothing.
- Parameters:
- Return type:
tuple[PatternRisk, …]
Examples
>>> [risk.rule for risk in analyse_pattern(r"^(a+)+$")] ['nested-quantifier'] >>> analyse_pattern(r"\bEMP-\d{6}\b") () >>> analyse_pattern(r"(\w+,)+") ()
Gallery examples#
Cleanprompt Packs and Formats: Records, Configs and Whole Folders
Cleanprompt Packs and Formats: Records, Configs and Whole Folders