Tinderbox Forum

Editing $Name with Action

Goal: I want to remove the first three characters of $Name for notes added to a container if the existing $Name of the note starts with ref.

I assume this requires an if statement.

Question: Is there a way using Tinderbox code to then remove the first three letters, or do you have to invoke REGEX?

Thanks.

if($Name.substr(0,3)==“ref”){$Name=$Name.replace(“ref”,"")}

This is one way to do it without using Regex.

I think it’s easier to say:

if($Name.substr(0,3)==“ref”){$Name=$Name.substr(3);}
1 Like

For the confused, ‘easier’ refers to the fact that .replace() is using regular expressions and .substr does not. Both work and in a small document the difference is moot. As/if your document grows, the difference may begin to show as regular expressions (regex) are generally more ‘work’ for the app to perform.