Skip to content

replace

relationalai.semantics.std.strings
replace(source: StringValue, old: StringValue, new: StringValue) -> Expression

Replace occurrences of old with new in the string source.

  • Expression - An Expression representing the string with replacements applied. Returns String.

Replace substrings within a string:

>>> strings.replace("My-name", "-", "_")
>>> strings.replace(Brand.name, "bee", "")
RelationalAI Documentation
└──  Build With RelationalAI
    └──  Understand how PyRel works > Use advanced reasoning > Rules-based reasoning
        └──  Work with strings
            └──  Build derived text values