Page MenuHome

Geometry Nodes: "Replace in String" node
ClosedPublic

Authored by Erik Abrahamsson (erik85) on Sep 30 2021, 11:00 PM.

Details

Summary

This patch adds a node that can be used to find and replace strings inside of the input string.

There are two modes:

  • Default, simple find and replace.
  • Regex, using regular expressions for more control.

Simple mode:



Regex mode:

Diff Detail

Repository
rB Blender

Event Timeline

Erik Abrahamsson (erik85) requested review of this revision.Sep 30 2021, 11:00 PM
Erik Abrahamsson (erik85) created this revision.
Hans Goudey (HooglyBoogly) requested changes to this revision.Oct 5 2021, 7:23 AM

Messing with the regular expressions in T91692, I got the regular expression mode to throw an exception. This should be caught. Ideally that would be a warning message for the node too, but we don't have an API for warning messages from function/field nodes currently.

Other than that, it seemed to work quite well.

Maybe "Replace in String" is a more obvious name?

This revision now requires changes to proceed.Oct 5 2021, 7:23 AM
Erik Abrahamsson (erik85) retitled this revision from Geometry Nodes: Replace String node to Geometry Nodes: "Replace in String" node.

Renamed from "Replace String" to "Replace in String".
Catch and print regex_error exception.

This revision is now accepted and ready to land.Oct 5 2021, 8:03 PM

Renamed again from "Replace in String" to "String Replace".

  • Rebased
  • Removed "is_function_node"
  • Removed regex mode for now. Will be added as a separate patch after solving some design questions.
  • Removed regex include
This revision was automatically updated to reflect the committed changes.