How to extract a given substring based on next starting and ending values


hello, I am having difficulty extracting a varible length substring from a given string. For instance I am trying to draw out all of the nicknames in a dynamo script. for example I know that the nickname looks like nickname=“List.Clean|DanEDU”, but it can be any name. So I want to use something like in excel you would use find(nickname="*") where the * would find anything in between those characters that meet the rest of the sting. But I cant seem to find a node that does that in Dynamo. please advise. thanks!


Use String.SplitByRegularExpression from Clockwork package (or find or Replace)


Is there a way to do this using a different starting and stopping point? Since I am trying to separate the nodes in a text file, the starting and stopping points are all the same between each node, but are different between themselves.

Also, why is this node REMOVING my regular expression from my string?

  1. Split the string the lines.
  2. String.StartsWith node to find the boolean s which begin with “nickname”
  3. Parse those lists as needed to replace/edit content.
  4. String.Join node to recreate a item.
  5. Write to a new file.


How do I split the string lines please?


String.Split node.

String is your original text.
Separator0 is a \r\n value.


I dont seem to be able to split the expression to anything.


I have just build a node for this… Node is named String.Substring

The migration solution you are trying to build in this post seems to be what I have build in the other thread you have made which is essentially the same problem!


A node to duplicate an existing function? Why?


Wow look at you go! I guess I can just convert via your script. But just so I dont get left behind I dont know how you intend to use the Sting.Substing node. I mean it sounds great, but this is what comes to my mind: Starting index; probably easy enough if all nodes are the same up unitl “nickname”, ending length = ?? because all the names are different lengths. So how exactly do you use that?image

I dont understand your used of the string.starts with either. I was able to get what looked like more promising results with String.Contains node. What exactly do you have in mind here?


start reading what I write… I have made a NEW node named “String.Substring”

…and script is a textual code mainly used is python scripting nodes, while graphs is what we build using dynamo.

You should be able to use my GRAPHS i have released at the other post where you started asking for migration om my long gone deprecated DanEDU package.


Oh yeah sorry, I figured that out when I opened your other “GRAPH”. :sweat_smile: I had some trouble with it however. Please see my comments on your other post.


I managed also to solve that problem… it is a matter of filtering for the nodes you use in a graph, and leave the other out…