Replace text and number from a string

Hello everyone, I have a data tree with 2 strings for each branch. I must delete the “z” letter and the following number. I tried to use “replace text” but I don’t know how to manage the number, because it changes for every branch.

Assigned to Grasshopper category

Here’s one way (in the future, upload a sample of your data).

regex pattern searches for Z followed by one or more digits followed by period followed by one or more digits

231013_replace_text_re.gh (7.8 KB)

Edit: in this case, you could also use ^Z as a regex pattern to eliminate character sequences that begin with Z

-Kevin

2 Likes

Thank you Kevin!