RegexMatch
relationalai.semantics.std.re
RegexMatch( regex: StringValue, value: StringValue, pos: IntegerValue = 0, type=RegexMatchType.MATCH,)Represents a regex match result with position and grouping support.
Attributes
Section titled “Attributes”Methods
Section titled “Methods”.start()
Section titled “.start()”RegexMatch.start() -> IntegerValueGet the starting position of the match.
Returns:
IntegerValue- The 0-based starting position of the match.
.end()
Section titled “.end()”RegexMatch.end() -> IntegerValueGet the ending position of the match.
Returns:
IntegerValue- The 0-based ending position of the match.
.span()
Section titled “.span()”RegexMatch.span() -> tuple[IntegerValue, IntegerValue]Get the start and end positions of the match.
Returns:
tuple[IntegerValue,IntegerValue] - A tuple of (start, end) positions.
.group()
Section titled “.group()”RegexMatch.group(index: IntegerValue = 0) -> VariableGet a capture group by index.
.. note:: This method is not yet implemented.
Parameters:
(indexIntegerValue, default:0) - The index of the capture group (0 for the entire match). Default: 0.
Returns:
Variable- A Variable representing the capture group content.
.group_by_name()
Section titled “.group_by_name()”RegexMatch.group_by_name(name: StringValue) -> VariableGet a named capture group.
.. note:: This method is not yet implemented.
Parameters:
(nameStringValue) - The name of the capture group.
Returns:
Variable- A Variable representing the named capture group content.
Inheritance Hierarchy
Section titled “Inheritance Hierarchy”Referenced By
Section titled “Referenced By”RelationalAI Documentation
└── Build With RelationalAI
└── Understand how PyRel works > Use advanced reasoning > Rules-based reasoning
└── Match text with patterns
└── Understand how std.re matches work