Skip to content

RegexMatch

relationalai.semantics.std.re
RegexMatch(regex: StringValue, value: StringValue, offset: IntegerValue = 0)

Represents a regex match result with position and grouping support.

RegexMatch.start() -> Variable

Get the starting position of the match.

Returns:

  • Variable - The 0-based starting position of the match.
RegexMatch.end() -> Variable

Get the ending position of the match.

Returns:

  • Variable - The 0-based ending position of the match.
RegexMatch.span() -> tuple[Variable, Variable]

Get the start and end positions of the match.

Returns:

  • tuple[Variable, Variable] - A tuple of (start, end) positions.
RegexMatch.group(index: IntegerValue = 0) -> Variable

Get a capture group by index.

Parameters:

  • index

    (IntegerValue, default: 0) - The index of the capture group (0 for the entire match). Default: 0.

Returns:

  • Variable - A Variable representing the capture group content.
RegexMatch.group_by_name(name: StringValue) -> Variable

Get a named capture group.

Parameters:

  • name

    (StringValue) - The name of the capture group.

Returns:

  • Variable - A Variable representing the named capture group content.
RegexMatchExpressionVariableDSLBase
 semantics > std > re
├──  fullmatch
├──  match
└──  search