Skip to content

match

relationalai.semantics.std.re
match(regex: StringValue, value: StringValue) -> RegexMatch

Check if the regex matches the value from the start.

  • regex

    (StringValue) - The regular expression pattern.
  • value

    (StringValue) - The string value to match against.
  • RegexMatch - A RegexMatch object representing the match result.

Match a pattern from the start of a string:

>>> re.match(r"S.*", Person.name)
>>> select(Person.name).where(re.match(r"^[A-Z]", Person.name))
RelationalAI Documentation
└──  Build With RelationalAI
    └──  Understand how PyRel works > Use advanced reasoning > Rules-based reasoning
        └──  Match text with patterns
            └──  Match prefixes with re.match