Class RuleDataRegex

class ooodev.dialog.search.tree_search.RuleDataRegex(regex='')[source]

Rule for matching a node’s data value with a regular expression pattern.

Parameters:

regex (re.Pattern | str) –

__init__(regex='')[source]

Constructor

Parameters:

regex (re.Pattern | str) – Regular expression pattern to match. If empty string, then the match_value of is_match)() must be a regular expression pattern. If included then the match_value of is_match() is ignored. Defaults to "".

Return type:

None

is_match(node, match_value)[source]

Gets the node’s text value and compares it with the match value.

Parameters:
  • node (XTreeNode) – Tree node to check.

  • match_value (Any) – Value to match. Must be a regular expression pattern to match.

Returns:

True if the node’s data value matches the match value; Otherwise, False.

Return type:

bool